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
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...