Skip to content

Smart filters examples #1930

Closed Answered by Haarolean
lumib95 asked this question in Q&A
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

Comment options

You must be logged in to vote
0 replies
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
2 participants