Splunk Search

How do you extract out relevant message from _raw, trimming the timestamp part?

jainkul123
Explorer

How can I trim the date timestamp from _raw. My _raw is as follows:

[1/13/19 10:18:20:577 GMT] 00000097 LogOut O INFO: Sun Jan 13 10:18:20 GMT 2019: **THIS IS MY MESSAGE STRING.* *

And I want to extract out just the message: THIS IS MY MESSAGE STRING.

0 Karma

tiagopeq
Explorer

This was the most generic regex I could find with the amount of information you shared, while staying minimally efficient I'd say:

| makeresults count=1
| eval _raw="[1/13/19 10:18:20:577 GMT] 00000097 LogOut O INFO: Sun Jan 13 10:18:20 GMT 2019: THIS IS MY MESSAGE STRING."
| rex "\[\d*\/\d*\/\d* \d{2}:\d{2}:\d{2}:\d{3}[^\]]+\].*INFO:[^:]+:\d{2}:\d{2}[^:]+:(?<_raw>.*)"
0 Karma

renjith_nair
Legend

@jainkul123 ,

Give this a try,

"your search"|rex field=_raw "\w{3}\s\w{3}\s+\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2}\s\w{3}\s\d{4}:\s(?<Message>.+)"
Happy Splunking!

jainkul123
Explorer

This works, thank you

0 Karma

skoelpin
SplunkTrust
SplunkTrust

If it works you should accept it to close out the question

0 Karma

rshah_splunk
Splunk Employee
Splunk Employee

You can try using the below regular expression.

  \[.*\].*?\w{3}\s+\w{3}\s+\d{1,2}\s+\d{2}\:\d{2}\:\d{2}\s\S+\s+\d{4}\:\s+(?.*)

Demo: https://regex101.com/r/ze1Jxk/1

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...