Splunk Search

How to extract base_url and guid values into two separate fields from our current sample URL field?

pdevosceazure
Path Finder

Hi

I have log files which collect url as:

cs_uri_stem="/dsa/api/playercommands/a6ada68b-7a72-4f38-b752-d99f7efd4cb8"

with a6ada68b-7a72-4f38-b752-d99f7efd4cb8 ( guid) different for all events.

I want to list all different base urls: like: /dsa/api/playercommands/

I cannot use the / because there can be more or less than 4.

I have a regex pattern to detect the guid, but that is just detecting it, I need to remove the guid.

I would also like to do the opposite which is only keep the guid so I can group per device.

So ideally, cs_uri_stem would become 2 fields: base_url and guid.

0 Karma

gokadroid
Motivator

How about this

your query to return fields
| rex field=cs_uri_stem "\"(?<base_url>\/([^\/]+\/)+)(?<guid>[^\"]+)\""
| table base_url, guid

see extraction here

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...