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
SplunkTrust
SplunkTrust

@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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...