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\""
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...