<?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 count eval results doesn't match the results under the Events tab in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-eval-results-doesn-t-match-the-results-under-the-Events/m-p/321843#M96144</link>
    <description>&lt;P&gt;I have a simple search with stats count eval (u_id is a numeric field):&lt;/P&gt;

&lt;P&gt;index=myindex base search | stats count(eval(u_id=1234)) as total&lt;/P&gt;

&lt;P&gt;The count which I see under "total" (under Statistics tab) does not match the number under Events tab.It seems the eval function is not performing right. But when I do the following search both number matches.&lt;/P&gt;

&lt;P&gt;index=myindex base search u_id=1234| stats count as total&lt;/P&gt;

&lt;P&gt;what's wrong with the first search? &lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 00:18:43 GMT</pubDate>
    <dc:creator>rarbabi</dc:creator>
    <dc:date>2017-02-22T00:18:43Z</dc:date>
    <item>
      <title>count eval results doesn't match the results under the Events tab</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-eval-results-doesn-t-match-the-results-under-the-Events/m-p/321843#M96144</link>
      <description>&lt;P&gt;I have a simple search with stats count eval (u_id is a numeric field):&lt;/P&gt;

&lt;P&gt;index=myindex base search | stats count(eval(u_id=1234)) as total&lt;/P&gt;

&lt;P&gt;The count which I see under "total" (under Statistics tab) does not match the number under Events tab.It seems the eval function is not performing right. But when I do the following search both number matches.&lt;/P&gt;

&lt;P&gt;index=myindex base search u_id=1234| stats count as total&lt;/P&gt;

&lt;P&gt;what's wrong with the first search? &lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 00:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-eval-results-doesn-t-match-the-results-under-the-Events/m-p/321843#M96144</guid>
      <dc:creator>rarbabi</dc:creator>
      <dc:date>2017-02-22T00:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: count eval results doesn't match the results under the Events tab</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-eval-results-doesn-t-match-the-results-under-the-Events/m-p/321844#M96145</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I would guess it's because in your first search, the count in the Events tab is showing all of the events returned by the base search. You're then using a transforming command (&lt;CODE&gt;stats&lt;/CODE&gt;) to produce your result.&lt;/P&gt;

&lt;P&gt;In the second search, you're filtering the events as part of that search (using the u_id=1234). So the count in the Events tab will be reduced.&lt;/P&gt;

&lt;P&gt;For example if I do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | stats count(eval(sourcetype="splunkd")) as total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'll get:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2533i008FBA85D3A1222F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;But if I do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype="splunkd" | stats count as total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2534iB01C8C1A02A020D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Whilst it's not 'strictly' true, you could think of the count in the Events tab as showing you the number of events your actual search returned, before applying any sort of transformation. Such as stats, chart, etc.&lt;/P&gt;

&lt;P&gt;Does that make sense?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 04:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-eval-results-doesn-t-match-the-results-under-the-Events/m-p/321844#M96145</guid>
      <dc:creator>gvmorley</dc:creator>
      <dc:date>2017-02-22T04:07:04Z</dc:date>
    </item>
  </channel>
</rss>

