<?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 top 5 IPs with highest distinct count emails per day? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165864#M47163</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;In each line of the logs ,there is an email, an IP address and a timestamp.&lt;/P&gt;

&lt;P&gt;I'd like to calculate for each day the top 1 (or top 5 or top 10) IPs which have the biggest number of distinct emails.&lt;/P&gt;

&lt;P&gt;I'm using this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bin span=1d _time
| stats dc(email) by ip,_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this doesn't do the trick since it prints a line for each IP and each day and I don't know to get only the top 5 dc(email) per IP&lt;/P&gt;

&lt;P&gt;I'd like the result to look like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time        dc(email)    ip

2014-07-28   50           10.1.1.1
             30           1.1.1.2
             20           1.1.1.3
             10           1.1.1.4
             10           1.1.1.4
2014-07-29   120          10.9.1.1
             85           25.1.1.2
             45           34.1.1.3
             35           26.1.1.4
             15           42.1.1.4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you guys know how to do this?&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jul 2014 17:15:13 GMT</pubDate>
    <dc:creator>niboucher</dc:creator>
    <dc:date>2014-07-31T17:15:13Z</dc:date>
    <item>
      <title>How to search top 5 IPs with highest distinct count emails per day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165864#M47163</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;In each line of the logs ,there is an email, an IP address and a timestamp.&lt;/P&gt;

&lt;P&gt;I'd like to calculate for each day the top 1 (or top 5 or top 10) IPs which have the biggest number of distinct emails.&lt;/P&gt;

&lt;P&gt;I'm using this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bin span=1d _time
| stats dc(email) by ip,_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this doesn't do the trick since it prints a line for each IP and each day and I don't know to get only the top 5 dc(email) per IP&lt;/P&gt;

&lt;P&gt;I'd like the result to look like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time        dc(email)    ip

2014-07-28   50           10.1.1.1
             30           1.1.1.2
             20           1.1.1.3
             10           1.1.1.4
             10           1.1.1.4
2014-07-29   120          10.9.1.1
             85           25.1.1.2
             45           34.1.1.3
             35           26.1.1.4
             15           42.1.1.4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you guys know how to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 17:15:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165864#M47163</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2014-07-31T17:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to search top 5 IPs with highest distinct count emails per day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165865#M47164</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;P&gt;|bucket _time span=1d | eventstats dc(email) by ip | top limit=5 dc(email),ip by _time |sort -_time, -dc(email)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:13:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165865#M47164</guid>
      <dc:creator>aelliott</dc:creator>
      <dc:date>2020-09-28T17:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to search top 5 IPs with highest distinct count emails per day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165866#M47165</link>
      <description>&lt;P&gt;Updated the answer, should be good now.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 18:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165866#M47165</guid>
      <dc:creator>aelliott</dc:creator>
      <dc:date>2014-07-31T18:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to search top 5 IPs with highest distinct count emails per day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165867#M47166</link>
      <description>&lt;P&gt;Another way of achieving the same&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | bin span=1d _time | stats dc(email) as dc by ip,_time | sort _time,dc | streamstats count by _time | where count &amp;lt; 6
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Jul 2014 18:31:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165867#M47166</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-31T18:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to search top 5 IPs with highest distinct count emails per day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165868#M47167</link>
      <description>&lt;P&gt;Wouldn't that be &lt;CODE&gt;where count &amp;lt; 6&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2014 22:56:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165868#M47167</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-08-01T22:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to search top 5 IPs with highest distinct count emails per day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165869#M47168</link>
      <description>&lt;P&gt;It indeed should be &amp;lt;6. Thanks for pointing it out.  I guess I'm in mood for early Friday..&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2014 23:17:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-top-5-IPs-with-highest-distinct-count-emails-per/m-p/165869#M47168</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-01T23:17:36Z</dc:date>
    </item>
  </channel>
</rss>

