<?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 distinct count and separate by type? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133786#M36551</link>
    <description>&lt;P&gt;You can disregard this, I was simply using "Eventtype=*" as a place holder for the search. You probably want a search closer to the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="raw_internet" produto="1" pessoa="F" date_hour!=0 | eventstats dc(user) as userCount | dedup user, tipo | table user, tipo, userCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Jun 2015 18:25:32 GMT</pubDate>
    <dc:creator>Thomas_Aneiro</dc:creator>
    <dc:date>2015-06-02T18:25:32Z</dc:date>
    <item>
      <title>How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133781#M36546</link>
      <description>&lt;P&gt;I need to make a distinct count of clients and together count what clients had at least one error message?&lt;/P&gt;

&lt;P&gt;I have client code, and type success, warning and error, and the same client makes multiple transactions, so i need to count how many distinct clients i have, and if this distinct clients had some error, count only one error per client. I don´t want to use append to keep my search light. Any suggestions?&lt;/P&gt;

&lt;P&gt;stats distinct_count(eval(clientcode)) as UniqueClient...&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 17:39:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133781#M36546</guid>
      <dc:creator>vitorvmiguel</dc:creator>
      <dc:date>2015-06-02T17:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133782#M36547</link>
      <description>&lt;P&gt;Can you post a sample event? At present, it looks like the &lt;CODE&gt;eval&lt;/CODE&gt; in &lt;CODE&gt;count&lt;/CODE&gt; is unnecessary.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 17:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133782#M36547</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-06-02T17:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133783#M36548</link>
      <description>&lt;P&gt;Would something like this work for you?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=*  | eventstats dc(user) as userCount | dedup user, error | table user, error, userCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2015 18:05:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133783#M36548</guid>
      <dc:creator>Thomas_Aneiro</dc:creator>
      <dc:date>2015-06-02T18:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133784#M36549</link>
      <description>&lt;P&gt;I don´t have any sample, because i´ve tested a ton of functions and none of them took the desirable result, here is my actual querie searching only the disctinct clients, so beside that i have a field type that has 3 possible values E (Error), W (Warning) and I (Success), so i need to filter inside those unique clients who faced an error.&lt;/P&gt;

&lt;P&gt;index="raw_internet" produto="1" pessoa="F" date_hour!=0 | stats distinct_count(codigoAcesso) as ClientesUnicos&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133784#M36549</guid>
      <dc:creator>vitorvmiguel</dc:creator>
      <dc:date>2020-09-28T20:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133785#M36550</link>
      <description>&lt;P&gt;What is this eventtype=* ? My event field is called "tipo", and its possible values are Error, Success, Warning&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 18:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133785#M36550</guid>
      <dc:creator>vitorvmiguel</dc:creator>
      <dc:date>2015-06-02T18:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133786#M36551</link>
      <description>&lt;P&gt;You can disregard this, I was simply using "Eventtype=*" as a place holder for the search. You probably want a search closer to the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="raw_internet" produto="1" pessoa="F" date_hour!=0 | eventstats dc(user) as userCount | dedup user, tipo | table user, tipo, userCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2015 18:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133786#M36551</guid>
      <dc:creator>Thomas_Aneiro</dc:creator>
      <dc:date>2015-06-02T18:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133787#M36552</link>
      <description>&lt;P&gt;Lots of ways to do this.&lt;/P&gt;

&lt;P&gt;| eval is_not_success=if(match(type,"I"),0,1)&lt;BR /&gt;
| stats sum(is_not_success) AS error_warn_count by clientcode&lt;BR /&gt;
| stats count AS TotalDistinctClients, count(eval(error_warn_count&amp;gt;0)) AS DistinctClientsWithErrors&lt;/P&gt;

&lt;P&gt;Apologies about the weird negation on "is_not_success" but it is necessary for the "sum".&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133787#M36552</guid>
      <dc:creator>jacobwilkins</dc:creator>
      <dc:date>2020-09-28T20:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to distinct count and separate by type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133788#M36553</link>
      <description>&lt;P&gt;It worked! Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2015 15:28:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-distinct-count-and-separate-by-type/m-p/133788#M36553</guid>
      <dc:creator>vitorvmiguel</dc:creator>
      <dc:date>2015-06-03T15:28:26Z</dc:date>
    </item>
  </channel>
</rss>

