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!

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...