Logstash Merge Field With Root Object

后端 未结 2 487
滥情空心
滥情空心 2021-01-20 16:09

I have logstash input that looks like this

{
    \"@timestamp\": \"2016-12-20T18:55:11.699Z\",
    \"id\": 1234,
    \"detail\": {
        \"foo\": 1
                


        
2条回答
  •  醉话见心
    2021-01-20 17:09

    There is a simple way to do that using the json_encode plugin (not included by default).

    The json extractor add fields to the root of the event. It's one of the very few extractors that can add things to the root.

    filter {
        json_encode {
            source => "detail"
            target => "detail"
        }
    
        json {
            source => "detail"
            remove_field => [ "detail" ]
        }
    }
    

提交回复
热议问题