How to parse the json string

I have a log file, which the content like below

{"log":"{\"time\":\"2020-12-02 22:42:00,535\", \"a_key\":\"a_value\"}\n","stream":"stdout","time":"2020-12-02T22:42:05.58702969Z"}

I want to parse the log field to json object, how to do that in logstash filter?

if it is pure json, in the "input" stanza of your logstash, you just need to mention code=> json (json codec)
if the original data as "json" in individual lines, then use json_lines

so something like..

input {
     codec => json

filter { }

output {
.. whatever...

Or if you want to filter as json, follow the example below

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.