Posts

Showing posts from December, 2019

Sumo Logic - Extract the Key from JSON object

Sumo Logic is a useful tool to monitor the logs from multiple micro-services, it has its own query language to retrieve data from the log message. One of them is extract Key/Value from JSON object within the results. For example, you have below log information: date: "2019-12-14" type: "error" body:"{      \"eventid\": \"XXXX-XXXX-XXXX-XXXX\",     \"userid\": "1234567890",     \"action\":"sample" }"   You need to get the "userid" from the JSON object "body", then you can write the code as below: | json field=body "userid" |