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!

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

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...