Splunk Search

Instead of a Home Page showing up with three different URLs, is there a way to combine all variations to one URL string?

spammenot66
Contributor

Is there anyway to treat all loaded home pages for a given URL path to be the same? For example the home page can show up as:
1) ending with forward slash, for example: http://mysite.com/site1/
2) have no forward slash at the end of the URI stem, for example http://mysite.com/site1
3) have an index.html file, for example: http://mysite.com/site1/index.html

Instead of site1 showing up with three different URLs, is there a way to combine all of them to show up as http://mysite.com/site1? Is there someway to remove last forward slash / or last instance of /index.html from the URL string?

0 Karma
1 Solution

lguinn2
Legend

You could do this in your search string like this

your_search_here
| url = case(like(url,"%/index.html"),substr(url,1,len(url)-11), 
                    like(url,"%/index.htm"),substr(url,1,len(url)-10), 
                    like(url,"%/"),substr(url,1,len(url)-1), 
                    1==1,url)
| next_thing_here

Hopefully I am not off-by-one on the string length calculations... 🙂

View solution in original post

lguinn2
Legend

You could do this in your search string like this

your_search_here
| url = case(like(url,"%/index.html"),substr(url,1,len(url)-11), 
                    like(url,"%/index.htm"),substr(url,1,len(url)-10), 
                    like(url,"%/"),substr(url,1,len(url)-1), 
                    1==1,url)
| next_thing_here

Hopefully I am not off-by-one on the string length calculations... 🙂

spammenot66
Contributor

thanks for the reply.

0 Karma
Get Updates on the Splunk Community!

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

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...