<?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: Inconsistent Count result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488810#M194022</link>
    <description>&lt;P&gt;Part of the issue with this search is you're using &lt;CODE&gt;dedup&lt;/CODE&gt; in your original search ( &lt;CODE&gt;sourcetype=xxx | dedup user | timechart span=1d count(user)&lt;/CODE&gt; )&lt;/P&gt;

&lt;P&gt;A better search is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ndx sourcetype=srctp user=*
| timechart span=1d dc(user)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you a distinct count of the &lt;CODE&gt;user&lt;/CODE&gt; field per day using the much simpler (and faster) &lt;CODE&gt;dc()&lt;/CODE&gt; ( &lt;CODE&gt;distinct_count()&lt;/CODE&gt; ) stats function - &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Aggregatefunctions#distinct_count.28X.29_or_dc.28X.29"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Aggregatefunctions#distinct_count.28X.29_or_dc.28X.29&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 14:28:04 GMT</pubDate>
    <dc:creator>wmyersas</dc:creator>
    <dc:date>2019-11-22T14:28:04Z</dc:date>
    <item>
      <title>Inconsistent Count result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488807#M194019</link>
      <description>&lt;P&gt;Original Search&lt;/P&gt;

&lt;P&gt;sourcetype=xxx | dedup user | timechart span=1d count(user)&lt;/P&gt;

&lt;P&gt;I found that the results are different for selecting the different time ranges&lt;/P&gt;

&lt;P&gt;Time Range         _time                                            count(user)&lt;BR /&gt;
All time :               2019-10-20                                 269&lt;BR /&gt;
during Oct 20:     2019-10-20                                 1473&lt;/P&gt;

&lt;P&gt;Why I got different results by selecting different time ranges?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 07:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488807#M194019</guid>
      <dc:creator>kcchu01</dc:creator>
      <dc:date>2019-11-22T07:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent Count result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488808#M194020</link>
      <description>&lt;P&gt;Hi @kcchu01,&lt;BR /&gt;
dedup has a limit of 10,000 results, if you want to exceed this limit you have to insert 0 in dedup command.&lt;BR /&gt;
Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=xxx 
| dedup 0 user 
| timechart span=1d count(user)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;P.S.: It's better to always use index in main search to have more performant searches.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 09:25:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488808#M194020</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-11-22T09:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent Count result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488809#M194021</link>
      <description>&lt;P&gt;It's also better to use &lt;CODE&gt;stats&lt;/CODE&gt; vs &lt;CODE&gt;dedup&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 14:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488809#M194021</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2019-11-22T14:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent Count result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488810#M194022</link>
      <description>&lt;P&gt;Part of the issue with this search is you're using &lt;CODE&gt;dedup&lt;/CODE&gt; in your original search ( &lt;CODE&gt;sourcetype=xxx | dedup user | timechart span=1d count(user)&lt;/CODE&gt; )&lt;/P&gt;

&lt;P&gt;A better search is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ndx sourcetype=srctp user=*
| timechart span=1d dc(user)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you a distinct count of the &lt;CODE&gt;user&lt;/CODE&gt; field per day using the much simpler (and faster) &lt;CODE&gt;dc()&lt;/CODE&gt; ( &lt;CODE&gt;distinct_count()&lt;/CODE&gt; ) stats function - &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Aggregatefunctions#distinct_count.28X.29_or_dc.28X.29"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Aggregatefunctions#distinct_count.28X.29_or_dc.28X.29&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 14:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Inconsistent-Count-result/m-p/488810#M194022</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2019-11-22T14:28:04Z</dc:date>
    </item>
  </channel>
</rss>

