Reporting

Finding data in Nested JSON in Splunk to create a splunk report

Denialsams
New Member

need help in extracting ID from nested JSON data in Splunk for including this in report. Sample data:

{"preview":false,"result":{"_raw":"{"severity":"INFO","logger":"eu.notas.fns.###.utility.LoggingUtil","thread":"qtp1951963537-1006","message":{"###RequestId":"<<>>","msgDesc":"Image id Successfully ","fileName":null,"errorDesc":null,"requestType":"API","destination":"###_SERVICES","errorCode":null,"source":"EXTERNAL_issue-in","externalRequestId":"<<>>","responseCode":null,"Id":"<<>>","service":"notas-###-issue-in-data-service","stackTrace":null}}","_time":"2021-04-28T11:47:51.318+0200","host":"notas-###-issue-in-data-service-147-qthsj","index":"###_app_prod","linecount":"1","logger":"eu.notas.fns.###.utility.LoggingUtil","message.destination":"###_SERVICES","message.errorCode":"null","message.errorDesc":"null","message.externalRequestId":"<<>>","message.fileName":"null","message.Id":"<<>>","message.###RequestId":"<<>>","message.msgDesc":"Image id Successfully ","message.requestType":"API","message.responseCode":"null","message.service":"notas-###-issue-in-data-service","message.source":"EXTERNAL_issue-in","message.stackTrace":"null","punct":"{"":"","":".....","":"-","":{"":"----","":"_____",","severity":"INFO","source":"###","sourcetype":"###-prod-log","splunk_server":"no1-psplunkidx-14","thread":"qtp1951963537-1006","unix_category":"all_hosts","unix_group":"default"}}

Labels (2)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

What part of your example data contains the ID data you want to extract. That data does not look to be a valid JSON object, i.e. _raw seems to be containing a quoted nested JSON object.

Is it that Id: "<<>>" field? If so, then the simplest way to extract that is

| rex field=_raw "\"Id\":\"(?<ID>[^\"]*)"

OR

| rex field=_raw "\"Id\":\"<<(?<ID>[^>]*)"

If you don't want the <<>> parts

 

0 Karma
Get Updates on the Splunk Community!

Splunk Classroom Chronicles: Training Tales and Testimonials (Episode 4)

Welcome back to Splunk Classroom Chronicles, our ongoing series where we shine a light on what really happens ...

From GPU to Application: Monitoring Cisco AI Infrastructure with Splunk Observability ...

AI workloads are different. They demand specialized infrastructure—powerful GPUs, enterprise-grade networking, ...

Application management with Targeted Application Install for Victoria Experience

  Experience a new era of flexibility in managing your Splunk Cloud Platform apps! With Targeted Application ...