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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

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