<?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: Help with Regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345249#M102302</link>
    <description>&lt;P&gt;Hi Masonmorales, desired output is what I meant by higher roll up, I want to display count for these navigations. Essentially all the URI patterns which have digits or ? are specific to individuals , we want to only consider until digit or ? is encountered.&lt;/P&gt;

&lt;P&gt;For example in our logs, we will have 3 values for uri field as below&lt;/P&gt;

&lt;P&gt;/Home/men-kids/summerwear/1059770200&lt;BR /&gt;
/Home/men-kids/summerwear/1059770201&lt;BR /&gt;
/Home/men-kids/summerwear/1059770202&lt;/P&gt;

&lt;P&gt;While we just want to count it as --&amp;gt;&lt;BR /&gt;
uri                                                   count&lt;BR /&gt;
/Home/men-kids/summerwear   3&lt;/P&gt;

&lt;P&gt;desired output&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;URI                                                                       Count&lt;/STRONG&gt;&lt;BR /&gt;
/Home/                                                                     50&lt;BR /&gt;
/Home/account-settings/                                    100&lt;BR /&gt;
/Home/men/clothing-360/                                    20&lt;BR /&gt;
/Home/men-kids/summerwear/                        123&lt;BR /&gt;
/Home/women-athelets/shoes                           100&lt;BR /&gt;
/Home/article/reviews/                                         200&lt;BR /&gt;
/Home/account-summary or /Home/account-summary?   220&lt;BR /&gt;
/Home/search or /Home/search?                                            112&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jun 2017 21:24:08 GMT</pubDate>
    <dc:creator>newbie2tech</dc:creator>
    <dc:date>2017-06-13T21:24:08Z</dc:date>
    <item>
      <title>Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345247#M102300</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Need help with regex for extracting desired output from below patterns.  I have ecommerce site where we want to find out navigation stats, i have field called uri which has values as listed below.&lt;/P&gt;

&lt;P&gt;I want to have a regex which will help me report stats by rolling up higher level instead of individual views.&lt;/P&gt;

&lt;P&gt;Can this be achieved using single regex, right now i have 4 different regexes, 1 for each of the patterns and then collating those numbers to generate the summary. Wanted to check if this can be achieved using single regex.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;uri field sample values&lt;/STRONG&gt;&lt;BR /&gt;
/Home/&lt;BR /&gt;
/Home/account-settings/&lt;BR /&gt;
/Home/men/clothing-360/XXL&lt;BR /&gt;
/Home/men-kids/summerwear/1059770200&lt;BR /&gt;
/Home/women-athelets/shoes/1793254100?tab=kobe-xyz&lt;BR /&gt;
/Home/article/reviews/?id=reviewsMetadata-abc033&lt;BR /&gt;
/Home/account-summary?actions=[setAccountType:personal;selectTab:rewards]&lt;BR /&gt;
/Home/search?q=2016%20%20form%201099&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;desired output&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;/Home/&lt;BR /&gt;
/Home/account-settings/&lt;BR /&gt;
/Home/men/clothing-360/&lt;BR /&gt;
/Home/men-kids/summerwear/&lt;BR /&gt;
/Home/women-athelets/shoes&lt;BR /&gt;
/Home/article/reviews/&lt;BR /&gt;
/Home/account-summary or /Home/account-summary?&lt;BR /&gt;
/Home/search or /Home/search?&lt;/P&gt;

&lt;P&gt;Please let me know if any further information is needed. I am on 6.5.2&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 20:09:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345247#M102300</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2017-06-13T20:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345248#M102301</link>
      <description>&lt;P&gt;Can you help us understand what the "higher level" you want to roll up to is? Also, what would your desired output look like?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 21:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345248#M102301</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2017-06-13T21:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345249#M102302</link>
      <description>&lt;P&gt;Hi Masonmorales, desired output is what I meant by higher roll up, I want to display count for these navigations. Essentially all the URI patterns which have digits or ? are specific to individuals , we want to only consider until digit or ? is encountered.&lt;/P&gt;

&lt;P&gt;For example in our logs, we will have 3 values for uri field as below&lt;/P&gt;

&lt;P&gt;/Home/men-kids/summerwear/1059770200&lt;BR /&gt;
/Home/men-kids/summerwear/1059770201&lt;BR /&gt;
/Home/men-kids/summerwear/1059770202&lt;/P&gt;

&lt;P&gt;While we just want to count it as --&amp;gt;&lt;BR /&gt;
uri                                                   count&lt;BR /&gt;
/Home/men-kids/summerwear   3&lt;/P&gt;

&lt;P&gt;desired output&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;URI                                                                       Count&lt;/STRONG&gt;&lt;BR /&gt;
/Home/                                                                     50&lt;BR /&gt;
/Home/account-settings/                                    100&lt;BR /&gt;
/Home/men/clothing-360/                                    20&lt;BR /&gt;
/Home/men-kids/summerwear/                        123&lt;BR /&gt;
/Home/women-athelets/shoes                           100&lt;BR /&gt;
/Home/article/reviews/                                         200&lt;BR /&gt;
/Home/account-summary or /Home/account-summary?   220&lt;BR /&gt;
/Home/search or /Home/search?                                            112&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 21:24:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345249#M102302</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2017-06-13T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345250#M102303</link>
      <description>&lt;P&gt;Try like this (everything except last line is to generate sample data, replace it with your search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval raw="/Home/ /Home/account-settings/ /Home/men/clothing-360/XXL /Home/men-kids/summerwear/1059770200 /Home/women-athelets/shoes/1793254100?tab=kobe-xyz /Home/article/reviews/?id=reviewsMetadata-abc033 /Home/account-summary?actions=[setAccountType:personal;selectTab:rewards] /Home/search?q=2016%20%20form%201099" | table raw | makemv raw | mvexpand raw | rename raw as uri 
| rex field=uri "^(?&amp;lt;URI&amp;gt;.+)\/.*" | stats count by URI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Updated regex&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..your base search..| rex field=uri "^(?&amp;lt;URI&amp;gt;(\/[^\/\?]+){1,3})"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 21:36:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345250#M102303</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-13T21:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345251#M102304</link>
      <description>&lt;P&gt;Check out these great apps:&lt;/P&gt;

&lt;P&gt;URL Parser: &lt;A href="https://splunkbase.splunk.com/app/1545/"&gt;https://splunkbase.splunk.com/app/1545/&lt;/A&gt;&lt;BR /&gt;
URL Toolbox: &lt;A href="https://splunkbase.splunk.com/app/2734/"&gt;https://splunkbase.splunk.com/app/2734/&lt;/A&gt;&lt;BR /&gt;
URL Expander (what is that tinyurl?): &lt;A href="https://splunkbase.splunk.com/app/3460/"&gt;https://splunkbase.splunk.com/app/3460/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 01:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345251#M102304</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-14T01:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345252#M102305</link>
      <description>&lt;P&gt;Thank you somesoni2 for the response, it is working in most of the cases except below scenarios[my bad as these were not part of original ask], can the same regex be tweaked to accommodate these as well. I am accepting the answer as you made this complex scenario deal with simple regex. Hope below scenarios can be accommodated as well.&lt;/P&gt;

&lt;P&gt;A forward slash at the end of desired output is not mandatory, no harm if we have on, if it makes any easier.&lt;BR /&gt;
/home/clothing/dry-fit/000000274/ --&amp;gt; should be /home/clothing/dry-fit&lt;BR /&gt;
/home/women-athelete/kobe/22540S836/--&amp;gt; should be /home/women-athelete/kobe&lt;BR /&gt;
/home/search/products?                --&amp;gt; should be /home/search/products and NOT /home/search&lt;BR /&gt;
/home/search/products/?id=home                --&amp;gt; should be /home/search/products and NOT /home/search&lt;BR /&gt;
/home/account-summary/purchases       --&amp;gt; should be /home/account-summary/purchases and NOT  /home/account-summary&lt;BR /&gt;
/purchases                    --&amp;gt; should be captured, current regex ignores this &lt;BR /&gt;
/home/products/all                     --&amp;gt; should be captured, current regex makes it /home/products/&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 20:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345252#M102305</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2017-06-14T20:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345253#M102306</link>
      <description>&lt;P&gt;thank you woodcock for pointing me to these apps, I would check them however I would not be able to install and use them in production for current problem, I will upvote the response for guidance.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 20:21:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345253#M102306</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2017-06-14T20:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345254#M102307</link>
      <description>&lt;P&gt;Try with updated regex.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 20:54:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345254#M102307</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-14T20:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345255#M102308</link>
      <description>&lt;P&gt;Thank you somesoni2...updated regex worked perfectly for all my scenarios...thanks a ton.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 14:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/345255#M102308</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2017-06-15T14:17:09Z</dc:date>
    </item>
  </channel>
</rss>

