<?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: Subtring from url field and then group  using the url in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231130#M188380</link>
    <description>&lt;P&gt;Got you. Thanks for the quick reply. &lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2016 16:48:10 GMT</pubDate>
    <dc:creator>arunprasadlv</dc:creator>
    <dc:date>2016-05-05T16:48:10Z</dc:date>
    <item>
      <title>Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231125#M188375</link>
      <description>&lt;P&gt;I have a field "BackendURL" which contains different url's.&lt;/P&gt;

&lt;P&gt;for eg :&lt;/P&gt;

&lt;P&gt;&lt;A href="http://abc.com/emp?name=jim&amp;amp;no=101"&gt;http://abc.com/emp?name=jim&amp;amp;no=101&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://abc.com/emp?name=tim&amp;amp;no=102"&gt;http://abc.com/emp?name=tim&amp;amp;no=102&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://gef.com/vehicle"&gt;http://gef.com/vehicle&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I am trying to generate a report by grouping the url's.  Now when i group i want to uniquely identify the backend url , but ignore  the queury params (anything after ?). I wrote this rex command to create a new field to substring the value before ? , but it does not work when the url does not contain "?" .&lt;/P&gt;

&lt;P&gt;index="idx" Consumer|rex field=BackendURL "^(?.+?)\?"|stats count by BackendURL,url_noparams, host&lt;/P&gt;

&lt;P&gt;Thanks and regards&lt;BR /&gt;
Arun&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 20:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231125#M188375</guid>
      <dc:creator>arunprasadlv</dc:creator>
      <dc:date>2016-05-04T20:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231126#M188376</link>
      <description>&lt;P&gt;Try this&lt;BR /&gt;
    | eval baseURL=mvindex(split(BackendURL, "?"), o) | stats count by baseURL&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 21:03:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231126#M188376</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-04T21:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231127#M188377</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="idx" Consumer|rex field=BackendURL  "(?P&amp;lt;requestedUrl&amp;gt;(?P&amp;lt;path&amp;gt;https*:\/\/((?P&amp;lt;contextRoot&amp;gt;[^\/\s]+)\/)?([^\/\s\?;=]+\/)*)((?P&amp;lt;filename&amp;gt;[^\/\s\?;=]+))?|\-)" |stats count by BackendURL,requestedUrl , host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 May 2016 21:21:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231127#M188377</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-04T21:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231128#M188378</link>
      <description>&lt;P&gt;Thanks a Lot. it worked!!&lt;/P&gt;

&lt;P&gt;But I am struggling to understand the logic . Would you pls explain&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Arun&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 23:16:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231128#M188378</guid>
      <dc:creator>arunprasadlv</dc:creator>
      <dc:date>2016-05-04T23:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231129#M188379</link>
      <description>&lt;P&gt;I'm splitting the url to it's different portions&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://abc.com/emp?name=jim&amp;amp;no=101" target="test_blank"&gt;http://abc.com/emp?name=jim&amp;amp;no=101&lt;/A&gt;
|--Path------------------|
          |--contextroot-|
                          |-filename-| 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2016 14:09:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231129#M188379</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-05T14:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231130#M188380</link>
      <description>&lt;P&gt;Got you. Thanks for the quick reply. &lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 16:48:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/231130#M188380</guid>
      <dc:creator>arunprasadlv</dc:creator>
      <dc:date>2016-05-05T16:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/537152#M188381</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;Could you please help if the same url contextPath also has path params?&lt;/P&gt;&lt;P&gt;eg - i can have urls of 2 formats&lt;/P&gt;&lt;P&gt;&lt;A href="http://abc.com/emp?name=jim&amp;amp;no=101" target="_blank"&gt;http://abc.com/emp?name=jim&amp;amp;no=101&lt;BR /&gt;http://abc.com/car/ford&lt;BR /&gt;http://abc.com/car/tesla&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;here i need the count of uri paths like below&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;/car/{id} = 2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;/emp = 1&amp;nbsp; (ignore query params)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 05:08:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/537152#M188381</guid>
      <dc:creator>donB</dc:creator>
      <dc:date>2021-01-26T05:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Subtring from url field and then group  using the url</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/537432#M188382</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval url="http://abc.com/test/emp?name=jim&amp;amp;no=101 http://abc.com/test/car/ford http://abc.com/test/car/tesla" | table url | makemv url | mvexpand url | eval url=replace(url,"\?","/") 
| rename "COMMENT" as "Above code generates sample data. Replace it with your query"
|rex field=url   "(?P&amp;lt;requestedUrl&amp;gt;(?P&amp;lt;path&amp;gt;https*:\/\/((?P&amp;lt;contextRoot&amp;gt;[^\/\s]+)\/)?([^\/\s\?;=]+\/)*)((?P&amp;lt;filename&amp;gt;[^\/\s\?;=]+))?|\-)" | stats count by path&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Jan 2021 14:55:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtring-from-url-field-and-then-group-using-the-url/m-p/537432#M188382</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-01-27T14:55:50Z</dc:date>
    </item>
  </channel>
</rss>

