Splunk Search

Need help with rex extraction including double quotes and slashes

gamerkhang
New Member

Hi,

I am currently trying to extract the numbers from this field example:

message.data

... {\"MyID\":\"111111\", ...

so I wrote the following rex expression, with no results:

rex field=message.data "\\\"MyID\\\":\\\"(?<MyID>\d+)\\\""

I have tried different amounts of slashes, and I am confident that the section inside the parentheses is correct for my needs.

0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

....  | rex field=message.data "\"MyID([^\"]+\"){2}(?<MyID>\d+)"

View solution in original post

0 Karma

somesoni2
Revered Legend

Give this a try

....  | rex field=message.data "\"MyID([^\"]+\"){2}(?<MyID>\d+)"
0 Karma

gamerkhang
New Member

This worked for me. Thanks!

0 Karma

MuS
Legend

Please use the code function while selecting the regex to keep formatting; code can be applied by clicking the 101010 icon or pressing CTRL-k

cheers, MuS

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

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