Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.39 KB

filter.md

File metadata and controls

38 lines (28 loc) · 1.39 KB

filter operator

The filter operator filters incoming entries that match an expression.

Configuration Fields

Field Default Description
id filter A unique identifier for the operator
output Next in pipeline The connected operator(s) that will receive all outbound entries
expr required Incoming entries that match this expression will be dropped
drop_ratio 1.0 The probability a matching entry is dropped (used for sampling). A value of 1.0 will drop 100% of matching entries, while a value of 0.0 will drop 0%.

Examples

Filter entries based on a regex pattern

- type: filter
  expr: '$record.message matches "^LOG: .* END$"'
  output: my_output

Filter entries based on a label value

- type: filter
  expr: '$labels.env == "production"'
  output: my_output

Filter entries based on an environment variable

- type: filter
  expr: '$record.message == env("MY_ENV_VARIABLE")'
  output: my_output