Splunk Search

How to create a rex for search?

New Member

I have the below log line:
Slow GraphQL query [8447ms]

How can I grab only the value "8447"?

Tags (2)
0 Karma


Search-time? Index-time? Are all the events similar? Is that the whole event?

If you just want a search-time rex way with the example data being the whole event:

... | rex "\[(?P<ms>\d+)ms\]"

If it isn't the entire event, then use the field=yourfieldname option to the rex command.

0 Karma



Please find the following imagealt text

0 Karma
Get Updates on the Splunk Community!

Streamline Data Ingestion With Deployment Server Essentials

REGISTER NOW!Every day the list of sources Admins are responsible for gets bigger and bigger, often making the ...

Remediate Threats Faster and Simplify Investigations With Splunk Enterprise Security ...

REGISTER NOW!Join us for a Tech Talk around our latest release of Splunk Enterprise Security 7.2! We’ll walk ...

Introduction to Splunk AI

WATCH NOWHow are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. ...