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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...