<?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 Stats count question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-count-question/m-p/481877#M193129</link>
    <description>&lt;P&gt;I have a requirement to find whether multiple users from the same source IP failed authentication for example.  My test case is as follows:&lt;/P&gt;

&lt;P&gt;I have an external IP address ==&amp;gt; 1.2.3.4&lt;BR /&gt;
I have 3 users for example ==&amp;gt; User1, User2, User3&lt;/P&gt;

&lt;P&gt;User1, User2 and User3 would normally have their own IP addresses that they log in with.  My requirement is to see if all 3 users are coming from the same external IP address&lt;/P&gt;

&lt;P&gt;Based on this I created the following search&lt;/P&gt;

&lt;P&gt;index=inboundconns event="login found" | stats values(user) as user, count(user) as count by src&lt;/P&gt;

&lt;P&gt;This gives me a table as follows (src 1.2.3.4 shows 3 users with a count of 3)&lt;/P&gt;

&lt;P&gt;src | user | count&lt;BR /&gt;
9.8.7.6 | user6 | 1&lt;BR /&gt;
6.5.4.3 | user 88 | 2&lt;BR /&gt;
1.2.3.4 | User 1 | 3&lt;BR /&gt;
             | User 2&lt;BR /&gt;
             | User 3&lt;/P&gt;

&lt;P&gt;I then try and expand on the search to pick up on the "1.2.3.4" address and omit the "6.5.4.3" address.  This is because "6.5.4.3" is only a single user from a single IP address.&lt;/P&gt;

&lt;P&gt;I extend my query as follows&lt;/P&gt;

&lt;P&gt;index=inboundconns event="login found" | stats values(user) as user, count(user) as count by src | where count &amp;gt; 1&lt;/P&gt;

&lt;P&gt;This query then removes the first row in the able which is expected.  However I need to be able to enhance this by doing the count by user and not by "count".  So "where the user count &amp;gt; 1 for a specific or distinct src" show this and omit all else.  &lt;/P&gt;</description>
    <pubDate>Tue, 17 Sep 2019 02:35:53 GMT</pubDate>
    <dc:creator>willadams</dc:creator>
    <dc:date>2019-09-17T02:35:53Z</dc:date>
    <item>
      <title>Stats count question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-count-question/m-p/481877#M193129</link>
      <description>&lt;P&gt;I have a requirement to find whether multiple users from the same source IP failed authentication for example.  My test case is as follows:&lt;/P&gt;

&lt;P&gt;I have an external IP address ==&amp;gt; 1.2.3.4&lt;BR /&gt;
I have 3 users for example ==&amp;gt; User1, User2, User3&lt;/P&gt;

&lt;P&gt;User1, User2 and User3 would normally have their own IP addresses that they log in with.  My requirement is to see if all 3 users are coming from the same external IP address&lt;/P&gt;

&lt;P&gt;Based on this I created the following search&lt;/P&gt;

&lt;P&gt;index=inboundconns event="login found" | stats values(user) as user, count(user) as count by src&lt;/P&gt;

&lt;P&gt;This gives me a table as follows (src 1.2.3.4 shows 3 users with a count of 3)&lt;/P&gt;

&lt;P&gt;src | user | count&lt;BR /&gt;
9.8.7.6 | user6 | 1&lt;BR /&gt;
6.5.4.3 | user 88 | 2&lt;BR /&gt;
1.2.3.4 | User 1 | 3&lt;BR /&gt;
             | User 2&lt;BR /&gt;
             | User 3&lt;/P&gt;

&lt;P&gt;I then try and expand on the search to pick up on the "1.2.3.4" address and omit the "6.5.4.3" address.  This is because "6.5.4.3" is only a single user from a single IP address.&lt;/P&gt;

&lt;P&gt;I extend my query as follows&lt;/P&gt;

&lt;P&gt;index=inboundconns event="login found" | stats values(user) as user, count(user) as count by src | where count &amp;gt; 1&lt;/P&gt;

&lt;P&gt;This query then removes the first row in the able which is expected.  However I need to be able to enhance this by doing the count by user and not by "count".  So "where the user count &amp;gt; 1 for a specific or distinct src" show this and omit all else.  &lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 02:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-count-question/m-p/481877#M193129</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2019-09-17T02:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Stats count question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-count-question/m-p/481878#M193130</link>
      <description>&lt;P&gt;@willadams,&lt;/P&gt;

&lt;P&gt;Try &lt;CODE&gt;dc&lt;/CODE&gt; or &lt;CODE&gt;distinct_count&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=inboundconns event="login found" | stats values(user) as user,dc(user) as count by src|where count &amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Sep 2019 13:28:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-count-question/m-p/481878#M193130</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-09-17T13:28:53Z</dc:date>
    </item>
  </channel>
</rss>

