Skip to main content

Filter Events

Basic event filtering can be performed with the filter action.

Include by Pattern

Exclude (discard) events with fields not matching a pattern

name: example-filter-pattern

input:
echo:
json: true
ignore-linebreaks: false
event: |
{"country": "Peru"}
{"country": "Brazil"}
{"country": "Italy"}

actions:
- filter:
patterns:
- country: "^B|^P"

output:
print: STDOUT

# output:
# {"country": "Peru"}
# {"country": "Brazil"}

Exclude by Pattern

Exclude events with fields matching a pattern

name: example-filter-exclude

input:
echo:
json: true
ignore-linebreaks: false
event: |
{"country": "Peru"}
{"country": "Brazil"}
{"country": "Italy"}

actions:
- filter:
exclude:
- country: "Bra"

output:
print: STDOUT

# output:
# {"country": "Peru"}
# {"country": "Italy"}

Include and Trim by Fields

Include events containing the specified fields, and any additional fields from matching events.

name: example-filter-exclude

input:
echo:
json: true
ignore-linebreaks: false
event: |
{"country": "Peru"}
{"country": "Brazil"}
{"country": "Italy", "city": "Rome"}

actions:
- filter:
schema:
- city

output:
print: STDOUT

# output:
# {"city": "Rome"}

Filter by JSON schema

The assert action supports positive and negative filtering by JSON schema specification.

TODO

Example coming soon