<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to group URLS based patterns? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325288#M174956</link>
    <description>&lt;P&gt;For your last question can you let me know what is the output you want when digits are replaced? The reason why I am asking is because martin_mueller has already given you a query to remove digits from URL. So please provide the expected output for the following:&lt;BR /&gt;
input= localhost/employees/100/comments&lt;BR /&gt;
output=?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2017 16:39:06 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-04-13T16:39:06Z</dc:date>
    <item>
      <title>How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325272#M174940</link>
      <description>&lt;P&gt;I have n of log files and i'm getting the proper result for each URL as of now, but im facing issue since the same url can be access by the same employee not sure what is the best way i can do it.&lt;BR /&gt;
Log files :&lt;/P&gt;

&lt;P&gt;index 1&lt;BR /&gt;
baseURL/employees&lt;BR /&gt;
baseURL/employees/{id}&lt;/P&gt;

&lt;P&gt;index 2&lt;BR /&gt;
baseURL/employees/{id}/comments&lt;BR /&gt;
baseURL/employees/{id}/comments/{id}&lt;/P&gt;

&lt;P&gt;index 2&lt;BR /&gt;
baseURL/employees/{id}/messages&lt;BR /&gt;
baseURL/employees/{id}/message/{id}&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 00:58:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325272#M174940</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T00:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325273#M174941</link>
      <description>&lt;P&gt;@jw44250... You would need to add some sample mock data and your existing metadata(field names)/existing query for us to come up with exact answer.. However, you can use the following in your case, assuming &lt;STRONG&gt;url&lt;/STRONG&gt; is the field containing URLs in your log (if not you would need to perform Field Extraction using Splunk's Interactive Field Extraction or &lt;STRONG&gt;rex&lt;/STRONG&gt; command):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearchWithIndexSourceType&amp;gt;
| stats count(eval(match(url,"^baseURL/employees/\d+$"))) as EmployeeAccessCount count(eval(match(url,"^baseURL/employees/\d+/comments/\d+$"))) as CommentsAccessCount count(eval(match(url,"^baseURL/employees/\d+/messages/\d+$"))) as MessagesAccessCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tested with following run anywhere search (you can change url and match condition as per your exact log data/field):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval url="baseURL/employees/12345/message/12345"
| table url
| stats count(eval(match(url,"^baseURL/employees/\d+/message/\d+$"))) as MessageAccessCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Apr 2017 02:42:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325273#M174941</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-12T02:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325274#M174942</link>
      <description>&lt;P&gt;Since i have httpRequestURL as key in log files i am getting result i am looking for but i want group them in such away after main urls:&lt;/P&gt;

&lt;P&gt;below example : matching employee with 100 and 800 are accessing comments url&lt;BR /&gt;
localhost/employees/100/comments &lt;BR /&gt;
localhost/employees/800/comments&lt;/P&gt;

&lt;P&gt;matching 600 and 900 id having 3 messages&lt;BR /&gt;
localhost/employees/600/messages/3&lt;BR /&gt;
localhost/employees/900/messages/3&lt;/P&gt;

&lt;P&gt;httpRequest&lt;BR /&gt;
localhost/employees/100/comments &lt;BR /&gt;
localhost/employees/200/comments/10&lt;BR /&gt;
localhost/employees/300/messages&lt;BR /&gt;
localhost/employees/400/message/3&lt;BR /&gt;
localhost/employees/800/comments&lt;BR /&gt;
localhost/employees/700/comments/10&lt;BR /&gt;
localhost/employees/600/messages/3&lt;BR /&gt;
baseURL/employees/400/message/3&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 04:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325274#M174942</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T04:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325275#M174943</link>
      <description>&lt;P&gt;Are you trying to group URLs while ignoring &lt;CODE&gt;/{id}&lt;/CODE&gt; segments? If so, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval grouped_url = replace(httpRequestURL, "/\d+", "") | stats count by grouped_url
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Apr 2017 07:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325275#M174943</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-04-12T07:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325276#M174944</link>
      <description>&lt;P&gt;i want to group by comments, employees, &lt;/P&gt;

&lt;P&gt;Like Level 1, Level 2, Level 3&lt;/P&gt;

&lt;P&gt;More Example&lt;/P&gt;

&lt;P&gt;URI HTTP METHOD DESCRIPTION&lt;BR /&gt;
/employee/add   POST    Add an employee&lt;BR /&gt;
/employee/getDummy  GET returns a dummy employee object&lt;BR /&gt;
/employee/{id}/get  GET Get the employee with ‘id’ in the URI&lt;BR /&gt;
/employee/getAll    GET Get all employees&lt;BR /&gt;
/employee/{id}/delete   DELETE  Delete employee with ‘id’ in the URI&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:16:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325276#M174944</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T15:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325277#M174945</link>
      <description>&lt;P&gt;Yes i want to ignore /{id} yes..&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:17:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325277#M174945</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T15:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325278#M174946</link>
      <description>&lt;P&gt;i have 1000 of them with different paths&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325278#M174946</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T15:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325279#M174947</link>
      <description>&lt;P&gt;grouped_url = /api/v1/appName/100/message/groups343434&lt;/P&gt;

&lt;P&gt;How exclude things after id : grouped_url= /api/v1/appName/100&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:41:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325279#M174947</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T15:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325280#M174948</link>
      <description>&lt;P&gt;it does not working &lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 21:36:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325280#M174948</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-12T21:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325281#M174949</link>
      <description>&lt;P&gt;@jw44250, your questions/requirements seems to be changing.&lt;BR /&gt;
Since you have different types of URIs, I still expect that you should perform a match on URI with values like messages, comments, employees for you to come up with count etc. (you need to come up with cases based on your data):&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval URIType=case(match(URI,"comment") AND match(URI,"employee"),"EmployeeComment", match(URI,"message") AND match(URI,"employee"),"EmployeeMessage",1==1,"Employee")&lt;/CODE&gt;&lt;BR /&gt;
Following is run anywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval URI="localhost/employees/100/comments"
| eval URIType=case(match(URI,"comment") AND match(URI,"employee"),"EmployeeComment", match(URI,"message") AND match(URI,"employee"),"EmployeeMessage",1==1,"Employee")
| table URI URIType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to just remove digits and use the remaining URI, I would use martin_mueller's answer.&lt;/P&gt;

&lt;P&gt;If you want to exclude things after ID like you have asked last, you can try: &lt;CODE&gt;| eval requiredURI=replace(URI,"^([a-zA-Z]+\/[a-zA-Z]+\/\d+)\/([a-zA-Z]+)","\1")&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;Following is run anywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval URI="localhost/employees/100/comments"
| eval requiredURI=replace(URI,"^([a-zA-Z]+\/[a-zA-Z]+\/\d+)\/([a-zA-Z]+)","\1")
| table URI requiredURI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On a different approach you can split URIs by forward slash character &lt;STRONG&gt;/&lt;/STRONG&gt;. Then use mvindex to read what you are interested in. Like &lt;STRONG&gt;comments&lt;/STRONG&gt; in the example below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval arrURI=split(URI,"/")
| table URI arrURI
| search arrURI="comments"
| eval baseURI=mvindex(arrURI,1)
| eval commentNumURI=mvindex(arrURI,4)
| table URI arrURI baseURI commentNumURI
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Apr 2017 04:52:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325281#M174949</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-13T04:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325282#M174950</link>
      <description>&lt;P&gt;thanks since im analyzing lots of logs file i mean 100s of them.&lt;BR /&gt;
so getting urls like&lt;/P&gt;

&lt;P&gt;URLS : - /1/   or /3/hello .&lt;BR /&gt;&lt;BR /&gt;
/20012/users&lt;/P&gt;

&lt;P&gt;/%&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 05:49:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325282#M174950</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-13T05:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325283#M174951</link>
      <description>&lt;P&gt;@jw44250... You need to post URLs with code button ie. 10101010 so that it does not get omitted while posting. Please re-post URLs with the same.&lt;/P&gt;

&lt;P&gt;PS: If my answers above do not cater to your needs, I can convert my answer to comment. However, the same will still not flag this question as unanswered question for all Splunker's. Splunk can definitely handle what you are trying to achieve also if @martin_mueller is answering a question you can be assured that it is the best solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;So may be simplify your question and ask what you really need.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 05:58:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325283#M174951</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-13T05:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325284#M174952</link>
      <description>&lt;P&gt;Excluding following urls using searchmatch&lt;/P&gt;

&lt;P&gt;/xampp/zenario/&lt;BR /&gt;
/xmb/&lt;BR /&gt;
/xmldata&lt;BR /&gt;
/xmlrpc.php&lt;BR /&gt;
/xmlrpc/&lt;BR /&gt;
/xmlrpcs.inc&lt;BR /&gt;
/xoops/&lt;BR /&gt;
/xoops/userinfo.php&lt;BR /&gt;
/xoops_v2_rc3/html/&lt;BR /&gt;
/xyzabc.jsp&lt;BR /&gt;
/y4icpgtwvy0/&lt;BR /&gt;
/yabb/&lt;BR /&gt;
/yabbse-1.4.1/&lt;BR /&gt;
/yabbse/&lt;BR /&gt;
/yapig-0.92b/&lt;BR /&gt;
/yapig-0.95b/&lt;BR /&gt;
/yapig/&lt;BR /&gt;
/yfPxl446.php4&lt;BR /&gt;
/yfo267oib0m/&lt;BR /&gt;
/ymGVHWTx.php&lt;BR /&gt;
/z24d7fkor/&lt;BR /&gt;
/zabbix/&lt;BR /&gt;
/zapbook.cgi&lt;BR /&gt;
/zapbook/&lt;BR /&gt;
/zen-cart/&lt;BR /&gt;
/zenario/&lt;BR /&gt;
/zenariocms/&lt;BR /&gt;
/zencart/&lt;BR /&gt;
/200/&lt;BR /&gt;
/1/&lt;BR /&gt;
/2/&lt;BR /&gt;
/600/anc&lt;BR /&gt;
/zorum/&lt;BR /&gt;
/zpanel/&lt;BR /&gt;
/zsh&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:40:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325284#M174952</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2020-09-29T13:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325285#M174953</link>
      <description>&lt;P&gt;but still splunk returns of URLS even i didnt ask for it...using case and searchmatch &lt;BR /&gt;
it should return only that matching URL below why it returns other URLS which i did not ask for it&lt;BR /&gt;
eval grouped_url=case(searchmatch("/api/v7/service/*"), "cloudsite.com",1=1,requestURI)&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 07:14:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325285#M174953</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-13T07:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325286#M174954</link>
      <description>&lt;P&gt;How to replace localhost/employees/100/comments  with digit using eval with searchMax&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 16:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325286#M174954</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-04-13T16:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325287#M174955</link>
      <description>&lt;P&gt;For your previous request for excluding list of urls using searchmatch, can you provide one full url for each as an example?&lt;/P&gt;

&lt;P&gt;/xampp/zenario/&lt;BR /&gt;
/xmb/&lt;BR /&gt;
/xmldata&lt;BR /&gt;
....&lt;BR /&gt;
....&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 16:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325287#M174955</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-13T16:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to group URLS based patterns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325288#M174956</link>
      <description>&lt;P&gt;For your last question can you let me know what is the output you want when digits are replaced? The reason why I am asking is because martin_mueller has already given you a query to remove digits from URL. So please provide the expected output for the following:&lt;BR /&gt;
input= localhost/employees/100/comments&lt;BR /&gt;
output=?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 16:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-URLS-based-patterns/m-p/325288#M174956</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-13T16:39:06Z</dc:date>
    </item>
  </channel>
</rss>

