<?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 Why Stats count command is counting events that are missing in other searches? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657256#M227015</link>
    <description>&lt;P&gt;The first search query returns a count of 26 for domain X :&lt;/P&gt;
&lt;P&gt;index="web" sourcetype="weblogic_stdout" loglevel IN ("Emergency") | stats count by domain&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when I run the below query to just see the events corresponding to domain=X, I get zero events:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;index="web" sourcetype="weblogic_stdout" loglevel IN ("Emergency") domain="X"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any clue why this might be happening&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 21:17:52 GMT</pubDate>
    <dc:creator>abhijeetallu</dc:creator>
    <dc:date>2023-09-12T21:17:52Z</dc:date>
    <item>
      <title>Why Stats count command is counting events that are missing in other searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657256#M227015</link>
      <description>&lt;P&gt;The first search query returns a count of 26 for domain X :&lt;/P&gt;
&lt;P&gt;index="web" sourcetype="weblogic_stdout" loglevel IN ("Emergency") | stats count by domain&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when I run the below query to just see the events corresponding to domain=X, I get zero events:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;index="web" sourcetype="weblogic_stdout" loglevel IN ("Emergency") domain="X"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any clue why this might be happening&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657256#M227015</guid>
      <dc:creator>abhijeetallu</dc:creator>
      <dc:date>2023-09-12T21:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Stats count command is counting events that are missing in other searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657262#M227018</link>
      <description>&lt;P&gt;That generally means X is not X, i.e. if you put&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="web" sourcetype="weblogic_stdout" loglevel IN ("Emergency") domain="*X*"&lt;/LI-CODE&gt;&lt;P&gt;do you get results&lt;/P&gt;&lt;P&gt;If you do this in your first search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="web" sourcetype="weblogic_stdout" loglevel IN ("Emergency")
| eval trimmed_domain=trim(domain)
| eval bounded_domain=":".domain.":"
| stats count by domain trimmed_domain bounded_domain
| eval trimmed_equal_domain=if(trimmed_domain=domain, "YES", "NO")&lt;/LI-CODE&gt;&lt;P&gt;you may see whether you have leading or trailing spaces around X and if&amp;nbsp;trimmed_equal_domain is NO, then there are leading/trailing spaces.&lt;/P&gt;&lt;P&gt;The bounded domain makes it easier to see what's what by adding : before and after&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 04:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657262#M227018</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-12T04:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Stats count command is counting events that are missing in other searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657647#M227146</link>
      <description>&lt;P&gt;Thank you so much ! it worked. I was clueless what was happening and all this time it was a trailing space character !&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 16:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-Stats-count-command-is-counting-events-that-are-missing-in/m-p/657647#M227146</guid>
      <dc:creator>abhijeetallu</dc:creator>
      <dc:date>2023-09-14T16:46:32Z</dc:date>
    </item>
  </channel>
</rss>

