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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...