Documentation ¶
Index ¶
Constants ¶
View Source
const ErrorTag = "gogstash_filter_cond_error"
ErrorTag tag added to event when process geoip2 failed
View Source
const ModuleName = "cond"
ModuleName is the name used in config file
Variables ¶
View Source
var ( ErrorBuiltInFunctionParameters1 = errutil.NewFactory("Built-in function '%s' parameters error") BuiltInFunctions = map[string]govaluate.ExpressionFunction{ "empty": func(args ...any) (any, error) { if len(args) > 1 { return nil, ErrorBuiltInFunctionParameters1.New(nil, "empty") } else if len(args) == 0 { return true, nil } return args[0] == nil, nil }, "strlen": func(args ...any) (any, error) { if len(args) > 1 { return nil, ErrorBuiltInFunctionParameters1.New(nil, "strlen") } else if len(args) == 0 { return float64(0), nil } length := len(args[0].(string)) return float64(length), nil }, "map": func(args ...any) (any, error) { if len(args) > 1 { return nil, ErrorBuiltInFunctionParameters1.New(nil, "map") } else if len(args) == 0 { return []any{}, nil } s := reflect.ValueOf(args[0]) if s.Kind() != reflect.Slice { return nil, ErrorBuiltInFunctionParameters1.New(nil, "map") } ret := make([]any, s.Len()) for i := 0; i < s.Len(); i++ { ret[i] = s.Index(i).Interface() } return ret, nil }, "rand": func(args ...any) (any, error) { if len(args) > 0 { return nil, ErrorBuiltInFunctionParameters1.New(nil, "rand") } return rand.Float64(), nil }, } )
built-in functions
Functions ¶
Types ¶
type EventParameters ¶
EventParameters pack event's parameters by member function `Get` access
type FilterConfig ¶
type FilterConfig struct { config.FilterConfig Condition string `json:"condition"` // condition need to be satisfied FilterRaw []config.ConfigRaw `json:"filter"` // filters when satisfy the condition ElseFilterRaw []config.ConfigRaw `json:"else_filter"` // filters when does not met the condition // contains filtered or unexported fields }
FilterConfig holds the configuration json fields and internal objects
func DefaultFilterConfig ¶
func DefaultFilterConfig() FilterConfig
DefaultFilterConfig returns an FilterConfig struct with default values
Click to show internal directories.
Click to hide internal directories.