Dashboards & Visualizations

Rex command

prasant
Path Finder

Need help to extract value between 2 fields eg: below

"status":"Active",
"birthDate":"xxxx-03-06",

I am trying below

rex field=details "\"status\"\:\"(?<contactStatus>[^\n\r\",]+)*\"birthDate\""

NOTE: there is another status field, so I am trying to use this option, as I know "birthDate " follows "status" field.

Thanks for you help in advance

Tags (1)
0 Karma

prasant
Path Finder

Thanks,,, I used below "\"status\":\"(?<contactStatus>[^\n\r\"]*)\",\"birthDate\"", it also worked.

0 Karma

bowesmana
SplunkTrust
SplunkTrust

User (?s) for matching newline by . character. Try this

| makeresults
| eval details="\"status\":\"Active\",
\"birthDate\":\"xxxx-03-06\",
\"status\":\"otherstatus\""
| rex field=details "(?s)\"status\"\:\"(?<contactStatus>[^\"]*).+\"birthDate\""
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...