<?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: Simple eval + stats count by 2 fields not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89076#M22821</link>
    <description>&lt;P&gt;OMG.  I got it to work by changing '=' to '==' and putting the value in quotes!  HOW FICKLE!!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a  OR sourcetype=b | stats count  as Total
   count(eval(sourcetype=="a")) AS a_count   
   count(eval(sourcetype=="b")) AS b_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 13 Oct 2012 00:33:46 GMT</pubDate>
    <dc:creator>the_wolverine</dc:creator>
    <dc:date>2012-10-13T00:33:46Z</dc:date>
    <item>
      <title>Simple eval + stats count by 2 fields not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89075#M22820</link>
      <description>&lt;P&gt;What am I doing wrong?  I've tried several iterations of the following all which return 2 columns with a count of 0:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a  OR sourcetype=b | stats count   
   count(eval(sourcetype=a)) AS a_count   
   count(eval(sourcetype=b)) AS b_count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;"sourcetype=a OR sourcetype=b | stats count by sourcetype"  &amp;lt;= returns the correct counts but I'm unable to split the count out for further evaluation.  I need to be able to eval diff=(b_count-a_count).&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:37:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89075#M22820</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2020-09-28T12:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Simple eval + stats count by 2 fields not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89076#M22821</link>
      <description>&lt;P&gt;OMG.  I got it to work by changing '=' to '==' and putting the value in quotes!  HOW FICKLE!!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a  OR sourcetype=b | stats count  as Total
   count(eval(sourcetype=="a")) AS a_count   
   count(eval(sourcetype=="b")) AS b_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Oct 2012 00:33:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89076#M22821</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2012-10-13T00:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Simple eval + stats count by 2 fields not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89077#M22822</link>
      <description>&lt;P&gt;So glad I found this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2013 21:34:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89077#M22822</guid>
      <dc:creator>cmak</dc:creator>
      <dc:date>2013-02-04T21:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Simple eval + stats count by 2 fields not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89078#M22823</link>
      <description>&lt;P&gt;Exact same situation and exact same reaction. OMG. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2014 04:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89078#M22823</guid>
      <dc:creator>shikhanshu</dc:creator>
      <dc:date>2014-09-16T04:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Simple eval + stats count by 2 fields not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89079#M22824</link>
      <description>&lt;P&gt;I was looking for this for days! Thanks the_wolverine&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 10:06:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-eval-stats-count-by-2-fields-not-working/m-p/89079#M22824</guid>
      <dc:creator>AFAS</dc:creator>
      <dc:date>2016-08-04T10:06:27Z</dc:date>
    </item>
  </channel>
</rss>

