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
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...