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