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!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...