Splunk Search

I want to select failed

Michael_Schyma1
Contributor

Here is the raw data:

07/26/2012 08:03:39 AM LogName=System SourceName=USER32 EventCode=1073 EventType=2 Type=Warning ComputerName=W57364821 User=SYSTEM Sid=S-1-5-18 SidType=1 Category=0 CategoryString=none RecordNumber=37639 Message=The attempt to reboot W57364821 failed

This is what i have created so far:

Message=The attempt to reboot W57364821(?.\S+)

Tags (2)
0 Karma
1 Solution

Gilberto_Castil
Splunk Employee
Splunk Employee

Try this:

Message=.+?(?<opeation_result>\w+)$

As sdaniels indicates, we typically try this with an in-line search and then automate if necessary. This is a sample of a test search:

index=blah sourcetype=syslog bla blah | rex field=_raw "Message=.+?(?<opeation_result>\w+)$"

The question here is, does this make sense?

Good luck. Happy Splunking!

View solution in original post

Gilberto_Castil
Splunk Employee
Splunk Employee

Try this:

Message=.+?(?<opeation_result>\w+)$

As sdaniels indicates, we typically try this with an in-line search and then automate if necessary. This is a sample of a test search:

index=blah sourcetype=syslog bla blah | rex field=_raw "Message=.+?(?<opeation_result>\w+)$"

The question here is, does this make sense?

Good luck. Happy Splunking!

sdaniels
Splunk Employee
Splunk Employee

Thanks Gilberto

0 Karma

sdaniels
Splunk Employee
Splunk Employee

Are you trying to do this in the Search app? You need to use the rex command to extract the new field.

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/rex

...<search stuff>... | rex field=_raw "reboot W57364821(?<mfailed>.S+)" 

Assuming W57364821 is always going to be the same, otherwise you'll need to have a better regex.

sdaniels
Splunk Employee
Splunk Employee

Get a simple example working with the hardcoded host like above. Then modify it to be something like "reboot\s\S+(?\s\S+)" so it picks up failed regardless of hostname. I think that would do it but you'll have to check it. You could then also extract out the host name and have that to see where the failures are occuring.

Michael_Schyma1
Contributor

It is not going to be the same, but since the windows event logs are so big, not all that data is passed to the extraction tool in splunk so i have to use regexr.

0 Karma
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!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...