Splunk Search

Regex in splunk

malgru
New Member

Hello

I am trying to get a regex to work in splunk but without success, perhaps someone here can help me?

This work when I am testing (not in splunk)

", logdata="Process Code: -400
Process Message: [0]:ABC QRT 12764 NOT. <-PurchaseOrderLineId- HeadId:1415640 Division:10 Id:1-1>", marowver="7"

But how do I get an expression that works in Splunk? I want the string in bold: ABC QRT 12764 NOT

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

It would help to see your existing regex efforts.

Perhaps this will help: Process Message: \[\d+]:(?<processMessage>[\w\s]+)

---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

malgru
New Member

The regex that I got and work in other environments (Not Splunk ) is
(?<=Process Message)(.*)(?=<-DBTransaction)

Somehow it was not included in the my initial post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It would help to see your existing regex efforts.

Perhaps this will help: Process Message: \[\d+]:(?<processMessage>[\w\s]+)

---
If this reply helps you, Karma would be appreciated.
0 Karma

malgru
New Member

I just modified your example a little and it worked just fine, thanks

"(?<=Process Message:) \[\d+]:(?< basic_error_message>[\w\s]+)"
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...