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:
| json field=body "userid" |
For example, you have below log information:
date: "2019-12-14"You need to get the "userid" from the JSON object "body", then you can write the code as below:
type: "error"
body:"{
\"eventid\": \"XXXX-XXXX-XXXX-XXXX\",
\"userid\": "1234567890",
\"action\":"sample"
}"
| json field=body "userid" |
Comments
Post a Comment