<?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: EVAL for ELSE IF condition in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291929#M163801</link>
    <description>&lt;P&gt;sorry sloppy copy and paste on my part.&lt;BR /&gt;
null should be double quoted - or you could use isnull()&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2018 17:02:24 GMT</pubDate>
    <dc:creator>nickhills</dc:creator>
    <dc:date>2018-01-09T17:02:24Z</dc:date>
    <item>
      <title>EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291922#M163794</link>
      <description>&lt;P&gt;My logic for my field "Action" is below, but because there is different else conditions I cannot write an eval do achieve the below.&lt;/P&gt;

&lt;P&gt;if (Location="Varonis" AND (like(Path,"%Hosting%") &lt;BR /&gt;
then Status=Action Required&lt;/P&gt;

&lt;P&gt;else if(Location="Varonis" AND ( MonitoringStatus!="Monitored" OR MonitoringStatus=null )&lt;BR /&gt;
then Status=Action Required&lt;/P&gt;

&lt;P&gt;else if(Location="Varonis" AND ( DayBackUpStatus!="Backed Up" OR DayBackUpStatus=null )&lt;BR /&gt;
then Status=Action Required&lt;/P&gt;

&lt;P&gt;else if(Location="Varonis" AND ( DayBackUpStatus!="Backed Up" OR DayBackUpStatus=null )&lt;BR /&gt;
then Status=Action Required&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:31:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291922#M163794</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-01-09T15:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291923#M163795</link>
      <description>&lt;P&gt;Consider the &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/ConditionalFunctions#case.28X.2C.22Y.22.2C....29"&gt;case&lt;/A&gt; function.&lt;/P&gt;

&lt;P&gt;Example from the doc:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval description=case(error ==404, "Not found", error == 500,
"Internal Server Error", error == 200, "OK")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Though your example looks like it could be done in a single &lt;CODE&gt;if&lt;/CODE&gt;, using &lt;CODE&gt;OR&lt;/CODE&gt; to join the clauses since they all have the same return value of &lt;CODE&gt;Action Required&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291923#M163795</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T15:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291924#M163796</link>
      <description>&lt;P&gt;The last two statements look identical, so assuming there are 3 statements:&lt;/P&gt;

&lt;P&gt;Maybe case would be more useful:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|eval Status=case((Location="Varonis" AND (like(Path,"%Hosting%"))),"Action Required",(Location="Varonis" AND ( MonitoringStatus!="Monitored" OR MonitoringStatus="null" )),"Action required",(Location="Varonis" AND ( DayBackUpStatus!="Backed Up" OR DayBackUpStatus="null" )),"Action Required",1&amp;lt;2,"No Action required")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:46:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291924#M163796</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2018-01-09T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291925#M163797</link>
      <description>&lt;P&gt;hey try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;your_base_query&amp;gt; 
| eval Status=if((Location="Varonis" AND like(Path,"%Hosting%")),"Action Required",(Location="Varonis" AND (MonitoringStatus!="Monitored" OR MonitoringStatus="null")),"Action Required",(Location="Varonis" AND (DayBackUpStatus!="Backed Up" OR DayBackUpStatus="null")),"Action Required","Action NOT Required")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps you!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:58:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291925#M163797</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T15:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291926#M163798</link>
      <description>&lt;P&gt;can you try below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval Status=if((Location="Varonis" AND like(Path,"%Hosting%")),"Action Required",(Location="Varonis" AND (MonitoringStatus!="Monitored" OR MonitoringStatus="null" OR DayBackUpStatus!="Backed Up" OR DayBackUpStatus="null")),"Action Required",1=1,"Action NOT Required")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have combined two conditions&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 16:27:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291926#M163798</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-01-09T16:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291927#M163799</link>
      <description>&lt;P&gt;Thank you , this mostly works, the only issue is that for NULL values in DayBackUpStatus that exist within Varonis are not getting picked up as action required. &lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 16:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291927#M163799</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-01-09T16:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291928#M163800</link>
      <description>&lt;P&gt;hey @davidcraven02&lt;BR /&gt;
you need to put &lt;CODE&gt;null&lt;/CODE&gt; in &lt;CODE&gt;"null"&lt;/CODE&gt; in order to make it work.&lt;BR /&gt;
try my search!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 16:45:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291928#M163800</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T16:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291929#M163801</link>
      <description>&lt;P&gt;sorry sloppy copy and paste on my part.&lt;BR /&gt;
null should be double quoted - or you could use isnull()&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 17:02:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291929#M163801</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2018-01-09T17:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291930#M163802</link>
      <description>&lt;P&gt;This didnt work, the query below his doesnt pick up null values and when I use isnull() it makes all the status column equal  'Action Required'  for all&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval Status=case((Location="Varonis" AND (like(Path,"%Hosting%"))),"Action Required",
(Location="Varonis" AND ( MonitoringStatus!="Monitored" OR MonitoringStatus="null" )),"Action required", (Location="Varonis" AND ( DayBackUpStatus!="Backed Up" OR DayBackUpStatus="null" )),"Action Required",1&amp;lt;2,"No Action required")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:22:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291930#M163802</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-01-09T19:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291931#M163803</link>
      <description>&lt;P&gt;do the fields contain the word null, or are they empty?&lt;/P&gt;

&lt;P&gt;if empty, could you try MonitoringStatus!=*&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:36:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/291931#M163803</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2018-01-09T19:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677636#M231704</link>
      <description>&lt;P&gt;Having a similar issue,&lt;BR /&gt;&lt;BR /&gt;| eval Test= if( (like('thrown.extendedStackTrace',"%403%"),"403"),(like('thrown.extendedStackTrace',"%404%"),"404"),"###ERROR####")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But getting error as --&amp;gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;Error in 'EvalCommand': The expression is malformed. Expected ).&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 10:41:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677636#M231704</guid>
      <dc:creator>aniketsamudra</dc:creator>
      <dc:date>2024-02-15T10:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677648#M231712</link>
      <description>&lt;P&gt;Brackets in the wrong place and it looks like the else part of the first if should start with another if&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Test= if( (like('thrown.extendedStackTrace',"%403%"),"403", if(like('thrown.extendedStackTrace',"%404%"),"404","###ERROR####"))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 Feb 2024 12:08:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677648#M231712</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-02-15T12:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677737#M231744</link>
      <description>&lt;P&gt;Nope!&lt;/P&gt;&lt;P&gt;Getting error as&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;Error in 'EvalCommand': The expression is malformed. Expected ).&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Feb 2024 03:17:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677737#M231744</guid>
      <dc:creator>aniketsamudra</dc:creator>
      <dc:date>2024-02-16T03:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677738#M231745</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/264953"&gt;@aniketsamudra&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should use case statement like below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Test=case(like('thrown.extendedStackTrace',"%403%"),"403", like('thrown.extendedStackTrace',"%404%"),"404",1=1,"###ERROR####")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 03:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677738#M231745</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2024-02-16T03:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL for ELSE IF condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677739#M231746</link>
      <description>&lt;P&gt;Got it resolved.. corrected one bracket&lt;/P&gt;&lt;P&gt;Thank You so much for the pointer on 'if' required everytime&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 03:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-for-ELSE-IF-condition/m-p/677739#M231746</guid>
      <dc:creator>aniketsamudra</dc:creator>
      <dc:date>2024-02-16T03:31:03Z</dc:date>
    </item>
  </channel>
</rss>

