Splunk Search

Field extraction Help

moinyuso96
Path Finder

Description                     

Recorded value for [Turn On Test 123]

Recorded value for [Turn On Test 456]

Execute all Appliances

In process to Execute

 

I would like to create another field name "Status" whereby it only extract "Turn On" for "Recorded value for [Turn On Test xxx]" and "Execute" for "Execute all Appliances" & "In process to Execute"

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @moinyuso96,

as I said, the problem is that to correctly extract the status I need to know the format or the values of the status field.

If the values fo the status are defined and in a limitated number you can put these values in the regex, e.g. if the possible values are only "Tun On", "Turn Off" and "Execute", you could use them in the regex:

| rex "\[(?<status>Turn On|Turn Off|Execute)"

as you can see in https://regex101.com/r/VAPtVU/2

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @moinyuso96,

the extraction of a field in logs ad the ones you shared is easy, only one question: the status is always a dondition of two words (e.g. Turn on, Turn off, etc...) or not?

The possible statuses are fixed (e.g. only "Turn on" and Turn off"?

I ask this to exactly define the content of the status ield.

So if the status is always composed by two words, try this:

| rex "\[(?<status>\w+\s\w+)"

that you can test at https://regex101.com/r/VAPtVU/1

Ciao.

Giuseppe

0 Karma

moinyuso96
Path Finder

The status is not necessarily Turn On, I will also need to extract the word "Execute" where the location of the word is not the same for the case of "Execute All Appliances" and "In process to Execute".

 

I am actually looking if there is anyway I can extract those words regardless of the location in the sentence.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @moinyuso96,

as I said, the problem is that to correctly extract the status I need to know the format or the values of the status field.

If the values fo the status are defined and in a limitated number you can put these values in the regex, e.g. if the possible values are only "Tun On", "Turn Off" and "Execute", you could use them in the regex:

| rex "\[(?<status>Turn On|Turn Off|Execute)"

as you can see in https://regex101.com/r/VAPtVU/2

Ciao.

Giuseppe

gcusello
SplunkTrust
SplunkTrust

Hi @moinyuso96,

good for you, see next time!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Accelerate Splunk App Development with AI

  Learn how to automate the repetitive parts of your build cycle.   Watch On-Demand   Replay the Accelerate ...

Splunk Agent Observability: Measuring AI Value with Splunk Tokenomics on AWS

The AI landscape is moving faster than ever, and our latest 2026 State of Observability report provides the ...

Enterprise Security Watch Party: What’s New in 8.8 - Recap

Splunk Community HQ hosted a Splunk Enterprise Security Watch Party: What’s New In ES 8.8 last Thursday. I had ...