I am using json_lines codec along with http_input in my pipeline. One of the elements in my JSON is querystring. Usually, this codec is able to handle all the variants of valid jsons except below
When I use this event, logstash writes one line on log saying:
[2020-07-17T07:17:10,052][WARN ][logstash.codecs.jsonlines] JSON parse error, original data now in message field {:error=>#<LogStash::Json::ParserError: Invalid FieldReference: `p[]`>, :data=>"
When I tried using same json without '' after letter 'p', the codec is able to parse it correctly. So below json, works fine :
Yes, it is a known issue. The JSON is parsed OK, but when time comes to event.set the key it is treated as a field reference, which breaks. I believe you can work around this by using a json filter instead of a codec and setting the target option, or else by using mutate+gsub to strip the square brackets out.
The thing is, we are using json_lines codec along with http_input plugin, which is the first the thing running in pipeline. so unfortunately, we cant use mutate+gsub. Having said this, we tried using json filter but it cant handle mutiple jsons separated by new lines.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.