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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...