Splunk Search

Extract part of JSON object with its child or nested attributes

imprabha1989
New Member

Hi All,

Our data ingested into our Index are in proper JSON format & Splunk is converting into JSON object automatically  , but I'm unable to extract/access any of  the child object along with its nested attributes.

Example :

{
"name": "notificationService",
"requestId": "ee76e5cf-90cc-521f-bc96-bdf6f39f5bc8",
"parsedEvent": {
                "event": {
                                    "eventName": "Notification",
                                    "timestamp": "2020-11-26T18:55:14.000+11:00",
                                    "delivery": "NotifierSystem",
                                    "notificationEventType": "EMAIL"
                              },
 "metadata": {
                    "correlationId": "1603246877854"
                       }
},
"msg": "Starting to process event",
"time": "2020-11-26T08:02:39.123Z"
}

 

Search query :    .... | table  requestId, name, parsedEvent.metadata.correlationId, parsedEvent.event

Is getting me :

ee76e5cf-90cc-521f-bc96-bdf6f39f5bc8,notificationService, 1603246877854,<blank>

If you see, I'm not able to get the  "parsedEvent.event" object along with its child attributes, but i'm able to access "parsedEvent.metadata.correlationId"   successfully which doesn't have any child.

 Any help would be appreciated. 

Thanks in Advance.

 

Labels (1)
0 Karma

to4kawa
Ultra Champion

 

index=_internal | head 1 | fields _raw | eval _raw="{\"name\":\"notificationService\",\"requestId\":\"ee76e5cf-90cc-521f-bc96-bdf6f39f5bc8\",\"parsedEvent\":{\"event\":{\"eventName\":\"Notification\",\"timestamp\":\"2020-11-26T18:55:14.000+11:00\",\"delivery\":\"NotifierSystem\",\"notificationEventType\":\"EMAIL\"},\"metadata\":{\"correlationId\":\"1603246877854\"}},\"msg\":\"Starting to process event\",\"time\":\"2020-11-26T08:02:39.123Z\"}"
| spath parsedEvent output=parsedEvent
| spath input=parsedEvent event output=nest_event
| spath input=parsedEvent metadata output=nest_metadata

 

Splunk deploys everything, so you'll have to do it yourself to put it together

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Does this work for getting the eventName? That is, has the full extraction worked down to the lowest level?

 table  requestId, name, parsedEvent.metadata.correlationId, parsedEvent.event.eventName
0 Karma

imprabha1989
New Member

@ITWhisperer 

Yes, the full extraction to the lowest level is/are working. But it I want the whole event object with its nested attributes.  We can use rex operation on _raw data but looking for something that can help us easily access it as we normally do with in JSON objects or something that converts pointed JSON object  to a string.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Reparse _raw for the object you want

| spath path=parsedEvent.event
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...