<?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: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231715#M68725</link>
    <description>&lt;P&gt;I understand the confusion.  I am not looking for a single event, rather multiple events.&lt;/P&gt;

&lt;P&gt;i.e. A large group of events that show results by HOST, and if that HOST has events in method as X and Y it displays the data.&lt;/P&gt;

&lt;P&gt;Essentially, I am looking for a pattern and displaying results when that pattern is found.&lt;BR /&gt;&lt;BR /&gt;
Is this a clearer explanation? &lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2016 18:16:52 GMT</pubDate>
    <dc:creator>mgrosholz</dc:creator>
    <dc:date>2016-08-17T18:16:52Z</dc:date>
    <item>
      <title>Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231709#M68719</link>
      <description>&lt;P&gt;I am doing a search on two sourcetypes and looking for data that matches multiple parts of a field called &lt;STRONG&gt;method&lt;/STRONG&gt;.&lt;BR /&gt;
The two sourcetypes and first eval/case function work properly.&lt;BR /&gt;
The second function fails if I add any more to the if statement with the AND operation.&amp;lt;--fails as in does not show any data.&lt;BR /&gt;
The last part works with the stats/path if I remove the if statement that is causing trouble.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="A" OR sourcetype="B"
| eval HOST=case(sourcetype="A",host,sourcetype="B",host2)
| eval foo=if((method="X" AND method="Y" ...), "Suspect", null()) 
| stats values(foo) count(path) as PATH by HOST
| where PATH&amp;gt;=10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 17:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231709#M68719</guid>
      <dc:creator>mgrosholz</dc:creator>
      <dc:date>2016-08-17T17:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231710#M68720</link>
      <description>&lt;P&gt;Since method is a single field, you should try &lt;CODE&gt;OR&lt;/CODE&gt; instead of &lt;CODE&gt;AND&lt;/CODE&gt;. The &lt;CODE&gt;AND&lt;/CODE&gt; condition will not be true, &lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 17:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231710#M68720</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-17T17:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231711#M68721</link>
      <description>&lt;P&gt;The problem is I need that field to match on every part I AND.&lt;BR /&gt;
i.e. method must equal X,Y,Z,... to trigger/pull results.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:01:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231711#M68721</guid>
      <dc:creator>mgrosholz</dc:creator>
      <dc:date>2016-08-17T18:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231712#M68722</link>
      <description>&lt;P&gt;The expression &lt;CODE&gt;method="X" AND method="Y"&lt;/CODE&gt; will never be true as method can be either X or Y in same event.&lt;BR /&gt;
If you're looking to match that field method contains X and Y, then try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="A" OR sourcetype="B"
| eval HOST=case(sourcetype="A",host,sourcetype="B",host2)
| eval foo=if((match(method,"X") AND match(method,"Y")), "Suspect", null()) 
| stats values(foo) count(path) as PATH by HOST
| where PATH&amp;gt;=10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231712#M68722</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-17T18:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231713#M68723</link>
      <description>&lt;P&gt;The eval is executed per event, so on a single event, method can never be X AND Y at the same time...?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231713#M68723</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2016-08-17T18:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231714#M68724</link>
      <description>&lt;P&gt;Is method extracted as a multi-value field? If yes, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval foo=if(isnotnull(mvfind(method,"X")) AND isnotnull(mvfind(method,"Y"))...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:14:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231714#M68724</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-17T18:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231715#M68725</link>
      <description>&lt;P&gt;I understand the confusion.  I am not looking for a single event, rather multiple events.&lt;/P&gt;

&lt;P&gt;i.e. A large group of events that show results by HOST, and if that HOST has events in method as X and Y it displays the data.&lt;/P&gt;

&lt;P&gt;Essentially, I am looking for a pattern and displaying results when that pattern is found.&lt;BR /&gt;&lt;BR /&gt;
Is this a clearer explanation? &lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:16:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231715#M68725</guid>
      <dc:creator>mgrosholz</dc:creator>
      <dc:date>2016-08-17T18:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the eval if statement in my search not producing any results if I add anything more with the AND operation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231716#M68726</link>
      <description>&lt;P&gt;See if this works for you&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    sourcetype="A" OR sourcetype="B"
    | eval HOST=case(sourcetype="A",host,sourcetype="B",host2)
    | stats values(method) as method count(path) as PATH  by host
    | eval foo=if(mvfind(method,"X")&amp;gt;=0 AND mvfind(method,"Y")&amp;gt;=0, "found", "didnotfind")
    | where PATH&amp;gt;=10 
    | fields - method 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Aug 2016 02:49:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-eval-if-statement-in-my-search-not-producing-any/m-p/231716#M68726</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-18T02:49:03Z</dc:date>
    </item>
  </channel>
</rss>

