Splunk Search

How to write regex to filter out UUID before stats count in a search?

wang
Path Finder

In my logs, I have a variable req that contains a REST request which includes an UUID. How do I remove the UUID so that stats count by req will ignore the UUID?

req="v*/documents/*" | stats count by req

v2/documents/0003cfad-c6ce-46f1-b617-9efd95d79b52
v2/documents/0003cfad-c6ce-46f1-b617-9efd95d79b52/status
v2/documents/004083f4-467e-4d25-9d71-baf7087acb2b
v2/documents/004083f4-467e-4d25-9d71-baf7087acb2b/status
v2/documents/0063891d-6822-493e-a650-31cc57989310/create
v2/documents/00ee9bb9-e21b-44c7-b437-d0c7dd1057f8
v2/documents/00ee9bb9-e21b-44c7-b437-d0c7dd1057f8/status
v2/documents/00fcce48-1768-4e89-a58b-e699be061ae4/delete

Tags (4)
0 Karma
1 Solution

wang
Path Finder

Got it:
req="v*/documents/*" | rex field=req mode=sed "s/[a-fA-F0-9]{8}-([a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}//g" | stats count by req

View solution in original post

wang
Path Finder

Got it:
req="v*/documents/*" | rex field=req mode=sed "s/[a-fA-F0-9]{8}-([a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}//g" | stats count by req

icyfeverr
Path Finder

Can you provide an example output that you are currently getting and also provide an example of what your expecting based on your example above.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...