Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot filter messages by a json format #520

Open
ifat-afek opened this issue Jan 2, 2022 · 0 comments
Open

Cannot filter messages by a json format #520

ifat-afek opened this issue Jan 2, 2022 · 0 comments

Comments

@ifat-afek
Copy link

Describe the bug
I have a log file that contains both text strings and json-formatted log messages.
I tried to use router or filter in order to filter only the json messages but it didn't work. I followed the example in https://github.com/observIQ/stanza/blob/master/docs/operators/router.md

To Reproduce
I used the following pipeline:
pipeline:

  • id: message_type_router
    type: router
    routes:
    • output: message_router
      expr: '$.format == "json"'
  • id: message_router
    type: router
    routes:
    • output: stdout
      expr: '$record.log != nil and $record.log.message != nil and $record.log.message matches "XYZ"

Expected behavior
Json formatted messages should be passed to message_router and then checked against the expression (that fails for regular strings).

Actual behavior
I get errors in the log:
{"level":"warn","timestamp":"2022-01-02T16:28:05.671Z","message":"Running expression returned an error","operator_id":"$.message_type_router","operator_type":"router","error":"invalid operation: int(string) (1:3)\n | $.format == "json"\n | ..^"}

Environment:

  • Running on k8s
  • Stanza Version 1.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant