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!

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...

Edge Processor Scaling, Energy & Manufacturing Use Cases, and More New Articles on ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Get More Out of Your Security Practice With a SIEM

Get More Out of Your Security Practice With a SIEMWednesday, July 31, 2024  |  11AM PT / 2PM ETREGISTER ...