Splunk Search

Trouble extracting field using regex

gopx101
New Member

I'm having an issue using regex to extract some _raw data and I hope someone can help me.

The below regex examples works successfully in a regex checker but not in Splunk.

Regex:
^(?:query\/time\",\"value\":)(?P\d+) OR
^(query\/time\",\"value\":)(?P\d+)

Data from Splunk _raw
"query/time\",\"value\":319

In this example I need to place 319 into variable query_time

Thanks in advance to anyone that can provide a regex that will work in Splunk.

0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

\"query\/time[^\:]+\:(?<YourFieldNameHere>\d+)

View solution in original post

0 Karma

pruthvikrishnap
Contributor

Try this :(.*)$
Let me know if this works

0 Karma

somesoni2
Revered Legend

Give this a try

\"query\/time[^\:]+\:(?<YourFieldNameHere>\d+)
0 Karma

lakromani
Builder

Are you sure you need to escape the : ?
Your suggestion

[^\:]+\:

I think this should work

[^:]+:
0 Karma

gopx101
New Member

This worked perfectly. Thank you.

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...