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
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:
type: router
routes:
expr: '$.format == "json"'
type: router
routes:
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: