I write logstash in json format, my logs have the following fields, each field is a string, and the atts field is a json string (note: atts subfields are different every time)
here is an example:
{"name":"bob","last":"builder", "atts":"{\"a\":111, \"b\":222}"}
I would like to parse it like this:
{ "name" => "bob", "last" => "builder" "atss" => { "a" => 111, "b" => 222} }
here is my configuration:
input { stdin { } } filter { json { source => "message" target => "parsed" } } output { stdout { codec => rubydebug }}
ok, so now I get the following:
{ "@timestamp" => 2017-04-05T12:19:04.090Z, "parsed" => { "atss" => "{\"a\":111, \"b\":222}", "name" => "bob", "last" => "the builder" }, "@version" => "1", "host" => "0.0.0.0" }
how can I parse the atts field in json to get:
{ "@timestamp" => 2017-04-05T12:19:04.090Z, "parsed" => { "atss" => {"a" => 111, "b" => 222}, "name" => "bob", "last" => "the builder" }, "@version" => "1", "host" => "0.0.0.0" }