filtermutate

package
v0.0.0-...-5039c01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 6 Imported by: 0

README

gogstash mutate filter module

Synopsis

At least one of split, replace or merge need to be set for this filter configuration to be valid. If merging does not succeed because destination field is not a string nor []string, gogstash_filter_mutate_error will be added to the event

filter:
  - type: mutate
    # 2 item array. First item is field to split. Second item is string to split with
    split: ["mycommalistvalue", ","]
    # 3 item array. First item is field to modify. Second item is value to replace. Third item is new value to replace with.
    replace: ["myfield", "oldvalue", "newvalue"]
    # 2 item array. First item is field to merge on. Second item is string to add to merged field
    merge: ["listofthings", "newitemtoadd"]

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name used in config file
	ModuleName = "mutate"
	// ErrorTag tag added to event when process module failed
	ErrorTag = "gogstash_filter_mutate_error"
)

Variables

View Source
var (
	ErrNotConfigured = errors.New("filter mutate not configured")
)

errors

Functions

func InitHandler

func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeFilterConfig, error)

InitHandler initialize the filter plugin

Types

type FilterConfig

type FilterConfig struct {
	config.FilterConfig

	Uppercase string    `yaml:"uppercase"`
	Lowercase string    `yaml:"lowercase"`
	Split     [2]string `yaml:"split"`
	Replace   [3]string `yaml:"replace"`
	Merge     [2]string `yaml:"merge"`  // merge string value into existing string slice field
	Rename    [2]string `yaml:"rename"` // rename field name into new field name
}

FilterConfig holds the configuration json fields and internal objects

func DefaultFilterConfig

func DefaultFilterConfig() FilterConfig

DefaultFilterConfig returns an FilterConfig struct with default values

func (*FilterConfig) Event

Event the main filter event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL