Splunk Search

How come the rex command is not working like normal regex?

jmorri6
Engager

Given a string:

(path=/myPath/123/endpoint,method=GET,accept=text/plain;version=0.0.4;q=1,*/*;q=0.1,content-type=null,accept-encoding=gzip,totalTime=127),

I want to retrieve the value for "path" and "totalTime" to create a visualization.

The rex...

rex field=log "path=(?< endpoint>\/\w+),totalTime=(?< milliseconds>\d+)"

...doesn't produce any results. I've tried several variations. Can anyone help with this rex?

It doesn't produce any results.

0 Karma
1 Solution

renjith_nair
Legend

@jmorri6

Try

path=(?<endpoint>[\/\w\d]+).+totalTime=(?<milliseconds>\d+)
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

tsaikumar009
Explorer

rex "path=(?P< endPoint>.*?)," | rex "totalTime=(?P< milliseconds>\d+)"

add these rex to your query to get the results.

0 Karma

renjith_nair
Legend

@jmorri6

Try

path=(?<endpoint>[\/\w\d]+).+totalTime=(?<milliseconds>\d+)
---
What goes around comes around. If it helps, hit it with Karma 🙂
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...