<?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: count condition in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464318#M191582</link>
    <description>&lt;P&gt;hi you said 'I want to count status failed only.' hence I made status=failed as 0.&lt;BR /&gt;
You can assign any value based on your need&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2019 06:48:54 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-08-28T06:48:54Z</dc:date>
    <item>
      <title>count condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464314#M191578</link>
      <description>&lt;P&gt;I'm having trouble writing a search statement that sets the count to 0 when the service is normally.&lt;/P&gt;

&lt;P&gt;This is my data example.&lt;/P&gt;

&lt;P&gt;name   status&lt;BR /&gt;
A           failed&lt;BR /&gt;
B           failed&lt;BR /&gt;
C           failed&lt;BR /&gt;
A           normally&lt;BR /&gt;
B           normally&lt;BR /&gt;
C           normally&lt;/P&gt;

&lt;P&gt;Counting with name  will also count normally.&lt;BR /&gt;
I want to count status failed only.&lt;/P&gt;

&lt;P&gt;In this case, everything is normally, I want to display 0.&lt;/P&gt;

&lt;P&gt;I know this is not correct, but I want to do like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval A =if((status=failed),count,null)
|stats count as A
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can't think of a conditional statement that counts when the status is failed.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 07:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464314#M191578</guid>
      <dc:creator>subachu</dc:creator>
      <dc:date>2019-08-27T07:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: count condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464315#M191579</link>
      <description>&lt;P&gt;instead of if , use a case&lt;BR /&gt;
|eval A=case(status=failed,1)&lt;BR /&gt;
 so A has counts only for failed status&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 12:47:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464315#M191579</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-27T12:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: count condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464316#M191580</link>
      <description>&lt;P&gt;Try this ? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;your search&amp;gt; | stats count(eval(status="failed")) as failed_count by name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Aug 2019 14:57:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464316#M191580</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-27T14:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: count condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464317#M191581</link>
      <description>&lt;P&gt;Thank you for helping.&lt;BR /&gt;
what do it mean (status=failed,1)?&lt;BR /&gt;
I thought (status=failed,0).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 04:13:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464317#M191581</guid>
      <dc:creator>subachu</dc:creator>
      <dc:date>2019-08-28T04:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: count condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464318#M191582</link>
      <description>&lt;P&gt;hi you said 'I want to count status failed only.' hence I made status=failed as 0.&lt;BR /&gt;
You can assign any value based on your need&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 06:48:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-condition/m-p/464318#M191582</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-28T06:48:54Z</dc:date>
    </item>
  </channel>
</rss>

