Skip to content

Smart filters examples #1930

Closed Answered by Haarolean
lumib95 asked this question in Q&A
May 6, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hey, thanks for reaching out.

We still haven't done any documentation on smart filters but we're planning to (#1865).

Right now, you can refer to this:

variables bind to groovy context: partition, timestampMs, keyAsText, valueAsText, header, key (json if possible), value (json if possible)

json parsing logic:
for key and value if they can be parsed to json they bound as json objects, if not - bound as null

sample scripts:

  1. keyAsText != null && keyAsText ~"([Gg])roovy" - regex on key as a string
  2. value.name == 'iliax' && value.age > 30 - when value is json
  3. value == null && valueAsText != null - search for values that are not null and are not json
  4. headers.sentBy == 'some system' && headers[…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@nelisSpotOn
Comment options

@Haarolean
Comment options

Answer selected by Haarolean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants