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!

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...

Splunk AppDynamics Agents Webinar Series

Mark your calendars! On June 24th at 12PM PST, we’re going live with the second session of our Splunk ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...