Splunk Search

How to extract fields with a trailing space after the delimiter character "=" (ex: Code= 999)?

arnabsen1234
New Member

Hi All,

I have a snippet as below :

  requestId="8b749da4-2996-437f-954d-2b679cd3239b"  Transaction Id= 1234, Alpha= 56789, Beta= 09876, Code= 999

I want to extract this Code.
Please note that "Code" has trailing = with space.

How do I extract this?

0 Karma

bmacias84
Champion

try this one

 ... | rex field=_raw "Code=\s+(?<code>[^\s,]+)" | table code
0 Karma

sk314
Builder

Try this:

... | rex field=_raw "Code=\s*(?<code>\d+)" | table code
0 Karma

arnabsen1234
New Member

This does not seem to be working. I am getting blank blank values for code

0 Karma

sk314
Builder

Could you post a sample event in its entirety?

0 Karma

somesoni2
Revered Legend
Try replacing \d+ with \w+ 
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!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...