<?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 get unique patterns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45377#M10760</link>
    <description>&lt;P&gt;Thank you. This view is also useful&lt;/P&gt;</description>
    <pubDate>Thu, 29 May 2014 16:29:57 GMT</pubDate>
    <dc:creator>xvxt006</dc:creator>
    <dc:date>2014-05-29T16:29:57Z</dc:date>
    <item>
      <title>How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45367#M10750</link>
      <description>&lt;P&gt;Hi, we would like to get unique query string patterns so that we can cache them at Akamai. i have written a query &lt;BR /&gt;
rex field=uri "\?(?&lt;COMMAND&gt;.*)"  | dedup command | table command&lt;/COMMAND&gt;&lt;/P&gt;

&lt;P&gt;Below is the output. You can see 1,2,4,5 etc are same pattern. So how do i get just the unique patterns. &lt;/P&gt;

&lt;P&gt;1   perPage=48&amp;amp;requestedPage=97&lt;BR /&gt;
2   perPage=48&amp;amp;requestedPage=95&lt;BR /&gt;
3   sst=subset&lt;BR /&gt;
4   perPage=48&amp;amp;requestedPage=96&lt;BR /&gt;
5   perPage=48&amp;amp;requestedPage=1&lt;BR /&gt;
6   bc=y&lt;BR /&gt;
7   redirect=socket+set&lt;BR /&gt;
8   searchQuery=2LDR7&amp;amp;fromCatalog=true&lt;BR /&gt;
9   ta=t&lt;BR /&gt;
10  searchQuery=2LDR8&amp;amp;fromCatalog=true&lt;BR /&gt;
11  searchQuery=cable+lug&lt;BR /&gt;
12  searchQuery=stainless+pallet&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2013 13:19:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45367#M10750</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-05-24T13:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45368#M10751</link>
      <description>&lt;P&gt;How do you define "pattern"? Name and order of parameters?&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2013 14:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45368#M10751</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-05-24T14:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45369#M10752</link>
      <description>&lt;P&gt;i define pattern as having different parameters (not worried about neither the order of the parameters as long as they are same parameters nor the values of them). So that is why i said 1,2,4,5 are one pattern (same parameters but different values. Even if same values also i am fine). number 3 is another pattern, number 6 and 7 are different patterns. 8 and 10 are same pattern, 11 and 12 are same pattern etc.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2013 14:23:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45369#M10752</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-05-24T14:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45370#M10753</link>
      <description>&lt;P&gt;Hmm yes..I guess..maybe&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | dedup uri | rex field=uri mode=sed "s/=[^&amp;amp;]+/=XXX/g" | dedup uri | eval uri = substr(uri,2) | table uri
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Haven't tested it, but it should replace all parameter values in the URL with 'XXX'. Yes there are 2 &lt;CODE&gt;dedup&lt;/CODE&gt;s. The first one is for reducing the number of uri's to be processed by &lt;CODE&gt;rex&lt;/CODE&gt;. You might skip it if the &lt;CODE&gt;uri&lt;/CODE&gt;'s are almost always different. &lt;/P&gt;

&lt;P&gt;This search does not take the order of the parameters into account, so&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;A=xxx&amp;amp;B=xxx
B=xxx&amp;amp;A=xxx 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would be considered different.&lt;/P&gt;

&lt;P&gt;Should hopefully work...&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2013 15:32:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45370#M10753</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-05-24T15:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45371#M10754</link>
      <description>&lt;P&gt;Hi Kristian why do you have substr(uri,2)?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2013 00:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45371#M10754</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-11-11T00:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45372#M10755</link>
      <description>&lt;P&gt;This was some time ago, so I don't really remember &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;The effect is to remove the first character of the uri. If not needed - skip that step.&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2013 05:33:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45372#M10755</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-11-11T05:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45373#M10756</link>
      <description>&lt;P&gt;Hi K, one question - why do you have eval uri = substr(uri,2)?&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 13:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45373#M10756</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-05-29T13:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45374#M10757</link>
      <description>&lt;P&gt;Even without eval uri = substr(uri,2) i am still getting the same results&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 13:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45374#M10757</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-05-29T13:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45375#M10758</link>
      <description>&lt;P&gt;Thank you. So it will just remove the first character only? &lt;BR /&gt;
so if i have uri as testuri?query=something, it will be esturi?query=something&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 13:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45375#M10758</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-05-29T13:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45376#M10759</link>
      <description>&lt;P&gt;Even better, use the 'cluster' command!&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
rex field=uri "?(?&lt;COMMAND&gt;.*)"  | cluster field=command | table command&lt;BR /&gt;
&lt;/COMMAND&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;With cluster you will get 2 fields, cluster_label (which is just the grouping number) and cluster_count (you many need to specify showcount=true, but this gives you the number of events in that grouping.&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 16:15:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45376#M10759</guid>
      <dc:creator>emccaslin</dc:creator>
      <dc:date>2014-05-29T16:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get unique patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45377#M10760</link>
      <description>&lt;P&gt;Thank you. This view is also useful&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 16:29:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-unique-patterns/m-p/45377#M10760</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-05-29T16:29:57Z</dc:date>
    </item>
  </channel>
</rss>

