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!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...