<?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 How to search for top 10 with stats list and count? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223865#M65926</link>
    <description>&lt;P&gt;I have the following search that looks for a count of blocked domains per IP:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname
|stats count by domain,src_ip
|sort -count 
|stats list(domain) as Domain, list(count) as count by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How would I limit the results to the top 10 IPs and still retain the count of blocked domains per IP? I've tried limit and head commands, but it nullifies the count of blocked domains per IP format.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2016 15:47:31 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2016-04-27T15:47:31Z</dc:date>
    <item>
      <title>How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223865#M65926</link>
      <description>&lt;P&gt;I have the following search that looks for a count of blocked domains per IP:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname
|stats count by domain,src_ip
|sort -count 
|stats list(domain) as Domain, list(count) as count by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How would I limit the results to the top 10 IPs and still retain the count of blocked domains per IP? I've tried limit and head commands, but it nullifies the count of blocked domains per IP format.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 15:47:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223865#M65926</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-04-27T15:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223866#M65927</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;Have you tried something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| top 10 src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname
|stats count by domain,src_ip
|sort -count 
|stats list(domain) as Domain, list(count) as count by src_ip
| top 10 src_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Apr 2016 16:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223866#M65927</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-27T16:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223867#M65928</link>
      <description>&lt;P&gt;I have, but the count for the top 10 hosts all equal 1.&lt;/P&gt;

&lt;P&gt;Doing |top 10 Domain by src_ip provides the same output of the count equaling 1.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 17:02:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223867#M65928</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-04-27T17:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223868#M65929</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname
 |stats count by domain,src_ip
 |sort -count 
 | streamstats count as rank by src_ip | where rank&amp;lt;=10 
 |stats list(domain) as Domain, list(count) as count by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;If you're looking for top 10 src_ip, then try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname
| stats count by domain,src_ip
|sort -count 
|stats list(domain) as Domain, list(count) as count sum(count) as total by src_ip 
| sort -total | head 10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Apr 2016 17:54:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223868#M65929</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-27T17:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223869#M65930</link>
      <description>&lt;P&gt;Thx for the modified search - retains the format of count of blocked domains per IP, but getting the full list of source IPs (src_ip) and not just the top 10.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 18:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223869#M65930</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-04-27T18:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223870#M65931</link>
      <description>&lt;P&gt;I think I figured it out after some fiddling. My query now looks like this:&lt;/P&gt;

&lt;P&gt;index=indexname&lt;BR /&gt;
|stats count by domain,src_ip&lt;BR /&gt;
|sort -count &lt;BR /&gt;
|stats list(domain) as Domain, list(count) as count, sum(count) as total by src_ip&lt;BR /&gt;
|sort -total | head 10&lt;BR /&gt;
|fields - total&lt;/P&gt;

&lt;P&gt;which retains the format of the count by domain per source IP and only shows the top 10&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223870#M65931</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2020-09-29T09:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for top 10 with stats list and count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223871#M65932</link>
      <description>&lt;P&gt;Thanks for this, if i want to see top 10 and all others in others? what will be the search? Can you please help?&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 05:29:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-top-10-with-stats-list-and-count/m-p/223871#M65932</guid>
      <dc:creator>ahmadsaadwarrai</dc:creator>
      <dc:date>2019-05-30T05:29:00Z</dc:date>
    </item>
  </channel>
</rss>

