I've set up syslog-ng 3.25.1 to read log messages from a file, parse them as JSON, and forward them to an ElasticSearch cluster.
This works well when the messages are formatted correctly as JSON, but in cases when json-parser
fails to find a valid JSON object in my log message, I'd like to wrap the non-JSON log message in a JSON object (via a format-json
template) and send it to a different index in ElasticSearch.
I understand that json-parser
can act as a filter to pass only valid JSON messages. Is there a way to create a filter that passes only invalid JSON messages?