Splunk Search

regex statement

JoshuaJohn
Contributor

I am trying to extract the response time from this statement (Just the number, not the words response time or the ms behind it)
Here is a regex statement I wrote ((response time: )(\w+)) this is splitting the number into the 3rd group but I am unsure as to how to remove the other two groups from the results as I need them to help with the matching aspect

Here is the statement I am trying to extract from:
<117>Aug 26 15:22:16 777-120 SLAVE[p-core_987734]: 2016-08-26 15:22:16,7t2 INFO [q44760481-48788] 6699-4871-a646-1b15556d queriesAndResponseTimeLogger - Client request: /search?keyword=tools+accessories&sendRefinements=false&count=3, response time: 70 ms, stage1Count=0, stage2Count=13, effectiveStage=STAGE2

The bolded number is the one I want

0 Karma
1 Solution

sundareshr
Legend

Try this regex

"response\stime\:\s+(?<response_time>\d+)\s"

View solution in original post

cdoebert
Path Finder

Use a positive lookbehind:

(?<=response time: )(\w+)
0 Karma

sundareshr
Legend

Try this regex

"response\stime\:\s+(?<response_time>\d+)\s"
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 ...