Knowledge Management

Field Extraction help!!!

splunker9999
Path Finder

Hi,

I am newbie to splunk,We are looking to extract a field from below event format.

"PDR Message Listener Completed Processing Message"

From above , we need to extract a field after "PDR Message Listener" as field called status as "Completed", Can someone help extraction using Rex command.

we tried using field extrcation from events ,but it is giving us some false results.

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

If you always have "PDR Message Listener" before the status value you want to capture, try this

your base search | rex "PDR Message Listener Completed (?<status>\s+)"

If the string before status value is not constant but always 3 words, then try this

your base search | rex "^(\w+\s){3}(?<status>\s+)"

View solution in original post

0 Karma

somesoni2
Revered Legend

If you always have "PDR Message Listener" before the status value you want to capture, try this

your base search | rex "PDR Message Listener Completed (?<status>\s+)"

If the string before status value is not constant but always 3 words, then try this

your base search | rex "^(\w+\s){3}(?<status>\s+)"
0 Karma

vasildavid
Path Finder

I think the capture group should be (?<status>\w+) and not use \s+, right?

edit: formatting

0 Karma

MuS
Legend

or if you want to use \s then it should be "^(\w+\s){3}(?<status>[^\s]+)"

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...