Getting Data In

Retrive only the key object from the json output

JyotiP
Path Finder

I have the following output and I want to extract only the key value of the JSON and those are addNewOrder,navigateReport etc in a table.

Details: {
    addNewOrder: {
       dur: 7706ms
       end: Wed Sep 18 2019 14:38:48 GMT+0530 (India Standard Time)
       navigationAPIData: {
         connectEnd: 1568797694032
         connectStart: 1568797694032
         domComplete: 1568797694775
         domContentLoadedEventEnd: 1568797694542
         domContentLoadedEventStart: 1568797694542
         domInteractive: 1568797694542
         domLoading: 1568797694255
         domainLookupEnd: 1568797694032
         domainLookupStart: 1568797694032
         fetchStart: 1568797694032
       }
        start: Wed Sep 18 2019 14:38:40 GMT+0530 (India Standard Time)
     }
    login: {
       dur: 7046ms
       end: Wed Sep 18 2019 14:38:17 GMT+0530 (India Standard Time)
       navigationAPIData: { 
       connectEnd: 1568797694032
         connectStart: 1568797694032
         domComplete: 1568797694775
         domContentLoadedEventEnd: 1568797694542
         domContentLoadedEventStart: 1568797694542
         domInteractive: 1568797694542
         domLoading: 1568797694255
         domainLookupEnd: 1568797694032
         domainLookupStart: 1568797694032
         fetchStart: 1568797694032
       }
       }
    navigateReport: { 
       dur: 2804ms
       end: Wed Sep 18 2019 14:38:28 GMT+0530 (India Standard Time)
     }   
    navigateOrder: {
       dur: 1804ms
       end: Wed Sep 18 2019 14:38:23 GMT+0530 (India Standard Time)
       }
    openNewOrder: { 
       dur: 1700ms
       end: Wed Sep 18 2019 14:38:33 GMT+0530 (India Standard Time)
       }
    openUrl: {
       dur: 3011ms
       end: Wed Sep 18 2019 14:38:00 GMT+0530 (India Standard Time)
       }
    }
0 Karma

jkat54
SplunkTrust
SplunkTrust

Check out extended examples number 2 & 3 here:

https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Spath

You need to spath, rename, zip, and then mvexpand. It's tricky but well documented. Follow the steps.

0 Karma

klischatb
Path Finder

have u tried field extractions with regex like : dur:\s(?(\d{1,4}))

0 Karma

JyotiP
Path Finder

Tried, but not working

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@JyotiP
Can you please share valid JSON event and your expected output?

0 Karma

JyotiP
Path Finder

@kamlesh_vaghela I have updated the JSON

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Thanks @JyotiP

It would be better if a single sample event from _raw. Like below

 {"trx":[{"type":"y","src":"x","htlids":[{"htlid":"XX123456","errCode":"1257"}]},{"type":"y","src":"x","htlids":[{"htlid":"YY123456","errCode":"1257"}]}],"ClientId":245860224012578433,"SeqNb":3102,"Type":"RsMonitor","Epoch":1568798767432}

Another question:
Your all mentioend fields addNewOrder,login,navigateReport,navigateOrder,openNewOrder,openUrl have other fields. Do you need any specific fields like dur from these fields?

0 Karma

JyotiP
Path Finder

@kamlesh_vaghela nope I want to select only the above-mentioned value in a table.

0 Karma

JyotiP
Path Finder

@kamlesh_vaghela the JSON output is too big, I only want to select the Kep value and put them in the table,
addNewOrder,login,navigateReport,navigateOrder,openNewOrder,openUrl

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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...