How to parse nested JSON data with logstash filter

458 views Asked by At

I have a json file which is having data like this

{
    "foo" : "bar",
    "test" : {
        "steps" : [{
                "response_time" : "100"
            }, {
                "response_time" : "101",
                "more_nested" : [{
                        "hello" : "world"
                    }, {
                        "hello2" : "world2"
                    }
                ]
            }
        ]
    }
}

I am using logstash filter, which is giving me wrong result

input {  
      file {
          sincedb_path =>  ".../sincedb_path.txt"
          path => ".../test.json"
          type => "test"
          start_position => "beginning"
      }
}



filter{
    json{
        source => "message"
    }

}



output {  
stdout { codec => rubydebug}

 }

How can i accomplish the events like steps.response_time :100 steps.more_nested.hello : world.

I tried with ruby but not working. I am using logstash 5.x version

0

There are 0 answers