<?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: stats count returns different results for indexed field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474999#M133535</link>
    <description>&lt;P&gt;I was trying to make my queries generic but must have skipped over that one.  I fixed the 3rd query of my original post.&lt;/P&gt;

&lt;P&gt;I just tried tstats and it returned a count of 436 rather than 68.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Apr 2020 12:53:55 GMT</pubDate>
    <dc:creator>bschaap</dc:creator>
    <dc:date>2020-04-13T12:53:55Z</dc:date>
    <item>
      <title>stats count returns different results for indexed field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474997#M133533</link>
      <description>&lt;P&gt;I'm having difficulty understanding why Query 2 is returning a different count than the other two queries.  The cluster_name field is an indexed field.  Does anyone know why this is occurring and have any suggestions to resolve or troubleshoot this issue?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 1&lt;/STRONG&gt;&lt;BR /&gt;
index=infra_k8s* sourcetype="kube:objects:pods" | stats count by cluster_name&lt;BR /&gt;
cluster_name count&lt;BR /&gt;
...&lt;BR /&gt;
clusterxyz &lt;STRONG&gt;&lt;EM&gt;436&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 2&lt;/STRONG&gt;&lt;BR /&gt;
index=infra_k8s* sourcetype="kube:objects:pods" cluster_name=clusterxyz | stats count by cluster_name&lt;BR /&gt;
cluster_name count&lt;BR /&gt;
clusterxyz &lt;STRONG&gt;&lt;EM&gt;68&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 3&lt;/STRONG&gt;&lt;BR /&gt;
index=infra_k8s* sourcetype="kube:objects:pods" | eval cluster=cluster_name | search cluster="clusterxyz" | stats count by cluster&lt;BR /&gt;
cluster count&lt;BR /&gt;
clusterxyz &lt;STRONG&gt;&lt;EM&gt;436&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474997#M133533</guid>
      <dc:creator>bschaap</dc:creator>
      <dc:date>2020-09-30T04:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: stats count returns different results for indexed field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474998#M133534</link>
      <description>&lt;P&gt;Okay, so there are two different relevant possibilities.  &lt;/P&gt;

&lt;P&gt;Run your other queries and something like this across the same time frame.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index=infra_k8s* sourcetype="kube:objects:pods" by cluster_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will give you the counts by solely the &lt;CODE&gt;cluster_name&lt;/CODE&gt; fields that were established at index time.  That should match your 68.&lt;/P&gt;

&lt;P&gt;Any more than those, are from fields that are being extracted at search time.&lt;/P&gt;

&lt;P&gt;(I'm assuming that &lt;CODE&gt;devonprem&lt;/CODE&gt; in query3 is your actual clustername, or that every event in cluster &lt;CODE&gt;devonprem&lt;/CODE&gt; is coincidentally having &lt;CODE&gt;clusterxyz&lt;/CODE&gt; extracted also.)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 21:47:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474998#M133534</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-04-10T21:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: stats count returns different results for indexed field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474999#M133535</link>
      <description>&lt;P&gt;I was trying to make my queries generic but must have skipped over that one.  I fixed the 3rd query of my original post.&lt;/P&gt;

&lt;P&gt;I just tried tstats and it returned a count of 436 rather than 68.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 12:53:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-returns-different-results-for-indexed-field/m-p/474999#M133535</guid>
      <dc:creator>bschaap</dc:creator>
      <dc:date>2020-04-13T12:53:55Z</dc:date>
    </item>
  </channel>
</rss>

