<?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 conditional if based on multiple condition in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223992#M176242</link>
    <description>&lt;P&gt;I have to get the count of records with multiple status and due date less than current date.. &lt;/P&gt;

&lt;P&gt;Below query - This query works for single status means  only Prod.. I get error on clubbing multiple status &lt;BR /&gt;
index = "my index"  Transaction_Type =*    Priority=*  Category=* |eventstats count as Total_Events |eval due_time= strptime('Due By',"%d.%m.%Y") |eval now_time= now() |stats count as Total_events  count(eval((due_time &amp;lt;= now_time) AND ('Status'!="Prod" OR 'Status'!="Go Live" OR 'Status'!="Completed"))) as Missed_count &lt;/P&gt;

&lt;P&gt;Please help&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 11:47:21 GMT</pubDate>
    <dc:creator>k_harini</dc:creator>
    <dc:date>2020-09-29T11:47:21Z</dc:date>
    <item>
      <title>conditional if based on multiple condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223992#M176242</link>
      <description>&lt;P&gt;I have to get the count of records with multiple status and due date less than current date.. &lt;/P&gt;

&lt;P&gt;Below query - This query works for single status means  only Prod.. I get error on clubbing multiple status &lt;BR /&gt;
index = "my index"  Transaction_Type =*    Priority=*  Category=* |eventstats count as Total_Events |eval due_time= strptime('Due By',"%d.%m.%Y") |eval now_time= now() |stats count as Total_events  count(eval((due_time &amp;lt;= now_time) AND ('Status'!="Prod" OR 'Status'!="Go Live" OR 'Status'!="Completed"))) as Missed_count &lt;/P&gt;

&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:47:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223992#M176242</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2020-09-29T11:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: conditional if based on multiple condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223993#M176243</link>
      <description>&lt;P&gt;Few points about searches&lt;/P&gt;

&lt;P&gt;1) They are more efficient if you use positive scenarios rather than negative (or NOT) scenarios i.e. if you know which status you need include only those.&lt;/P&gt;

&lt;P&gt;2) You should filter results upfront rather than later. This will give most performance improvement.&lt;BR /&gt;
IN the above case I assume Status is part of your extracted fields then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "my index" Transaction_Type=* Priority=* Category=* AND NOT (Status="Prod" OR Status="Go Live" OR Status="Completed") |eventstats count as Total_Events |eval due_time= strptime('Due By',"%d.%m.%Y") |eval now_time= now() |stats count as Total_events count(eval((due_time &amp;lt;= now_time))) as Missed_count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) You should also be converting now_time to dd.mm.YYYY format.&lt;/P&gt;

&lt;P&gt;PS: If you want to continue to use your existing query you can try the following since you are applying not for each conditions, OR should be replaced with AND:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "my index" Transaction_Type = Priority= Category=* |eventstats count as Total_Events |eval due_time= strptime('Due By',"%d.%m.%Y") |eval now_time= now() |stats count as Total_events count(eval((due_time &amp;lt;= now_time) AND ('Status'!="Prod" AND 'Status'!="Go Live" AND 'Status'!="Completed"))) as Missed_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Nov 2016 09:12:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223993#M176243</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-09T09:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: conditional if based on multiple condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223994#M176244</link>
      <description>&lt;P&gt;Thank you so much.. It worked.. Problem is I have to calculate the %. Hence If i give in base search I will not be able to get total count to calculate % .  In the first query my Total_Events  is same as Missed_count.. &lt;/P&gt;

&lt;P&gt;If there is any other better approach please let me know.. Thanks a lot..&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:47:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/conditional-if-based-on-multiple-condition/m-p/223994#M176244</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2020-09-29T11:47:24Z</dc:date>
    </item>
  </channel>
</rss>

