Amazon Cloudwatch Logs Insights with JSON fields

后端 未结 5 759
执笔经年
执笔经年 2020-12-28 13:18

I am trying to use Logs Insights with data containing JSON in one of the fields, and to parse the JSON fields

My data looks like the following when I put it in insig

5条回答
  •  感动是毒
    2020-12-28 14:01

    Also another parse with help of regex

    Assume your @message is:

    I, [2018-12-19T23:42:52.629855 #23447] INFO -- : [2ce588f1-c27d-4a55-ac05-62a75b39e762] {"method":"GET","path":"/api/v1/professionals/"}
    

    You can extract method by

    fields @timestamp, @message
    | parse @message /\"method\":\"(?.*?)\"/
    

提交回复
热议问题