Splunk Search

How extract specific value ?

Jean-Sébastien
Observer

Hello, 

I have big and complete log and want to extract specific value. 

Small part of log: "state":{"running":{"startedAt":"2024-12-19T13:58:14Z"}}}],

I would like to extract running in this case, value can be other . 

Could you please help me ? 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This looks like it might be JSON. Have you looked at the json functions?

kiran_panchavat
SplunkTrust
SplunkTrust

@Jean-Sébastien 


You can use rex command. The rex command matches the value of the specified field against the unanchored regular expression and extracts the named groups into fields of the corresponding names.

https://docs.splunk.com/Documentation/Splunk/9.4.0/SearchReference/Rex 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

kiran_panchavat
SplunkTrust
SplunkTrust

Hello @Jean-Sébastien 

You can use regex. This will create a new field called output that contains the values running, drinking, and walking. Let me know if you need more assistance!

kiran_panchavat_0-1735811981423.png

 

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!

yuanliu
SplunkTrust
SplunkTrust

It is best not to use rex to extract information from structured data.  As @ITWhisperer says, the OP should post complete sample logs instead of a fragment of JSON.  If the raw event is itself compliant JSON, there should be no need to extract using search commands because Splunk automatically does this at search time.

0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...