<?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: If statement with AND in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230968#M68506</link>
    <description>&lt;P&gt;You can use case statement instead the syntax is &lt;BR /&gt;
case (condition , TRUE, FALSE)&lt;/P&gt;

&lt;P&gt;You can have nested case statements as well for eg.&lt;BR /&gt;
|index=main | eval system=case(isnotnull(dest) AND dest!="unknown",dest,isnotnull(src) AND src!="unknown",src,isnotnull(dvc) AND dvc!="unknown",dvc,1=1,"unknown")&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2016 11:05:55 GMT</pubDate>
    <dc:creator>hardikJsheth</dc:creator>
    <dc:date>2016-08-17T11:05:55Z</dc:date>
    <item>
      <title>If statement with AND</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230967#M68505</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is it possible to use AND in an eval if statement.. for instance if(volume =10, "normal" if(volume &amp;gt;35 AND &amp;lt;40, "loud")) and so on.. I would like to add a few more if's into that as well..Any thoughts on how to structure it?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 10:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230967#M68505</guid>
      <dc:creator>mansel_scheffel</dc:creator>
      <dc:date>2016-08-17T10:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: If statement with AND</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230968#M68506</link>
      <description>&lt;P&gt;You can use case statement instead the syntax is &lt;BR /&gt;
case (condition , TRUE, FALSE)&lt;/P&gt;

&lt;P&gt;You can have nested case statements as well for eg.&lt;BR /&gt;
|index=main | eval system=case(isnotnull(dest) AND dest!="unknown",dest,isnotnull(src) AND src!="unknown",src,isnotnull(dvc) AND dvc!="unknown",dvc,1=1,"unknown")&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 11:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230968#M68506</guid>
      <dc:creator>hardikJsheth</dc:creator>
      <dc:date>2016-08-17T11:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: If statement with AND</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230969#M68507</link>
      <description>&lt;P&gt;Yes you could do that with if, but the moment you start nesting multiple ifs it's going to become hard to read.&lt;BR /&gt;
Why don't you use case instead?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval whatever = case (
    volume = 10, "normal",
    volume &amp;gt; 35 AND volume &amp;lt; 40, "loud",
    1 = 1, "default rule"
)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 11:06:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-statement-with-AND/m-p/230969#M68507</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-08-17T11:06:24Z</dc:date>
    </item>
  </channel>
</rss>

