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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...