Splunk Search

Field Extraction and search

cyler
New Member

Here is the line in the log I am working with;

Message=COMPUTERNAME [Monday, April 02, 2018 7:15:53 AM (GMT-06:00)]: Status of device 'COMPUTER' changed to Critical: Many viruses detected.

Goal;
I would like to search my database for all logs that have the status "Many viruses detected"

I am newer to splunk, I need to use rex correct? I do not think the field has been extracted yet.

After being able to find all the computers with this log, I would like to extract the field for future use.
My search;
index=my_index | rex field=_raw"(?)Message=(?[a-zA-z0-9:\s[]\-,=`'."]\sMany\sviruses\sdetected"

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

To return events with a specific string, just include that string in your base search.

index=my_index "Many viruses detected"
---
If this reply helps you, Karma would be appreciated.

View solution in original post

kmaron
Motivator

If you wanted to extract the computer name, message and status you could try something like this:

rex field=_raw "Status of device '(?<COMPUTERNAME>.*?)' (?<MESSAGE>.*?): (?<STATUS>.*?)\."
0 Karma

cyler
New Member

Thank you!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

To return events with a specific string, just include that string in your base search.

index=my_index "Many viruses detected"
---
If this reply helps you, Karma would be appreciated.

cyler
New Member

Thank you!

0 Karma

cyler
New Member

Thank you!

0 Karma

cyler
New Member

My search IS NOT working

0 Karma

PowerPacked
Builder

What value you want to capture from the above event using REX ?

0 Karma
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, ...