Dashboards & Visualizations

parsing URL regex

asdfxqwert
Explorer

I need help with regex for parsing a URL

 

The URL can be  a/b/c, a/b/c/d or a/b/c/d/e

In any case I need the resource of the URL -  c d e respectively for the above URLs. Can you help with a regex which can give the value after the last / 

 

Labels (1)
Tags (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

See the rex statement here

| makeresults
| eval urls=split("a/b/c,a/b/c/d,a/b/c/d/e",",")
| mvexpand urls
| rex field=urls ".*/(?<resource>.*)"

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

See the rex statement here

| makeresults
| eval urls=split("a/b/c,a/b/c/d,a/b/c/d/e",",")
| mvexpand urls
| rex field=urls ".*/(?<resource>.*)"
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

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 ...