Splunk Search

fetch one field value from json

rkishoreqa
Communicator

I need to fetch the 'sid' value from the below JSON.  

For that I prepared the below query, but it is not working. 

|rex field=_raw "sid\":\"(?P<sid>.[^\"\,\"]*)"
|stats count by sid

{
"sig_date": "11-SEP-2020 ",
"exe_date": "",
"sent_date": "13-JAN-2020",
"appr_date": "06-AUG-2020",
"comp_date": "08-SEP-2020",
"sid": "0ac00001789",
"visit": "Yes"
}
 
Can anyone please validate this query.
Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Amongst other things, you were missing a space. but it can be simplified to

rex "sid\":\s\"(?P<sid>[^\"]*)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Amongst other things, you were missing a space. but it can be simplified to

rex "sid\":\s\"(?P<sid>[^\"]*)"
Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...