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!

Dashboard Studio Challenge - Learn New Tricks, Showcase Your Skills, and Win Prizes!

Reimagine what you can do with your dashboards. Dashboard Studio is Splunk’s newest dashboard builder to ...

Introducing Edge Processor: Next Gen Data Transformation

We get it - not only can it take a lot of time, money and resources to get data into Splunk, but it also takes ...

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...