Splunk Search

Why is the following regex command not terminating as expected?

Log_wrangler
Builder

I have events like this....

<22>2018-10-10T09:38:50.631063-05:00 m0074417 sendmail[16942]: w9AEM7sO030350: to=<thisguy@thatplace.com>

and I want to capture this qid > w9AEM7sO030350

I wrote a regex that worked in regex101 like this...

sendmail+\S+\s(.+)\:\s

and I get just the string I want... but it won't work in Splunk, when I use

index=mail  w9AEM7sO030350 |rex field=_raw "sendmail+\S+\s(?<stitcher>.+)\:" |stats values(stitcher)

or if I use...

index=mail w9AEM7sO030350 |rex field=_raw "sendmail+\S+\s(?<stitcher>.+)\:\s" |stats values(stitcher)

in the events there is a space after the colon, but I cannot get it to stop capturing before the " : ".

Perhaps I am doing this wrong?

Please advise.
Thank you

Tags (2)
0 Karma
1 Solution

Log_wrangler
Builder

this seems to work...

 | rex field=_raw "sendmail+\S+\s(?<stitcher>[[:alnum:]]+)\:"  |stats values(stitcher)

View solution in original post

0 Karma

Log_wrangler
Builder

this seems to work...

 | rex field=_raw "sendmail+\S+\s(?<stitcher>[[:alnum:]]+)\:"  |stats values(stitcher)
0 Karma
Get Updates on the Splunk Community!

Why You Can't Miss .conf25: Unleashing the Power of Agentic AI with Splunk & Cisco

The Defining Technology Movement of Our Lifetime The advent of agentic AI is arguably the defining technology ...

Deep Dive into Federated Analytics: Unlocking the Full Power of Your Security Data

In today’s complex digital landscape, security teams face increasing pressure to protect sprawling data across ...

Your summer travels continue with new course releases

Summer in the Northern hemisphere is in full swing, and is often a time to travel and explore. If your summer ...