<?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 Question about eval if 4 arguments in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309374#M92789</link>
    <description>&lt;P&gt;Hi, i try to select on same event  with different Values and they give result différent  but Splunk find none result. Can you  tell me what is wrong on my command ? Thanks &lt;/P&gt;

&lt;P&gt;eval Agent= if(isnull(Agent) OR ( Agent=="aaa*", "bbb*") OR (Agent=="ccc*" , "ddd*" ,"reee*")OR (Agent=="*"),Messagerie, AC,MANAGERS,TECHNICIENS )&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 12:55:18 GMT</pubDate>
    <dc:creator>Abarny</dc:creator>
    <dc:date>2020-09-29T12:55:18Z</dc:date>
    <item>
      <title>Question about eval if 4 arguments</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309374#M92789</link>
      <description>&lt;P&gt;Hi, i try to select on same event  with different Values and they give result différent  but Splunk find none result. Can you  tell me what is wrong on my command ? Thanks &lt;/P&gt;

&lt;P&gt;eval Agent= if(isnull(Agent) OR ( Agent=="aaa*", "bbb*") OR (Agent=="ccc*" , "ddd*" ,"reee*")OR (Agent=="*"),Messagerie, AC,MANAGERS,TECHNICIENS )&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309374#M92789</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2020-09-29T12:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question about eval if 4 arguments</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309375#M92790</link>
      <description>&lt;P&gt;&lt;CODE&gt;(field="value1", "value2")&lt;/CODE&gt; is not a valid &lt;CODE&gt;eval&lt;/CODE&gt; expression. If you're looking for a list of possible values, you will need to spell them out explicitly like this: &lt;CODE&gt;(field="value1" OR field="value2")&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Similarly, &lt;CODE&gt;if()&lt;/CODE&gt; only takes three arguments - the condition, the then-value, and the else value. If you're trying to test several conditions and yield a different result for each condition, you'll want to use &lt;CODE&gt;case()&lt;/CODE&gt; like this: &lt;CODE&gt;case(condition1, value1, condition2, value2, ...)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/CommonEvalFunctions#Comparison_and_Conditional_functions"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/CommonEvalFunctions#Comparison_and_Conditional_functions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 09:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309375#M92790</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-17T09:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Question about eval if 4 arguments</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309376#M92791</link>
      <description>&lt;P&gt;Thanks :).&lt;/P&gt;

&lt;P&gt;I try with your solution but I think it's false again.  I am a trainee and I try to do my best.  So just bear with me.  ( and with my English :))&lt;/P&gt;

&lt;P&gt;eval Personnel =case(Agent == null() , "Messagerie", Agent ==("aa*" OR "bb*"), "AC", Agent=="*",TECHNICIENS) |stats count by Personnel&lt;/P&gt;

&lt;P&gt;The last Agent is for give the reste of the values&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309376#M92791</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2020-09-29T12:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Question about eval if 4 arguments</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309377#M92792</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval Personnel =case(isnull(Agent) , "Messagerie", like(Agent,"aa%") OR like(Agent,"bb%"), "AC", 1=1,TECHNICIENS) |stats count by Personnel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, &lt;BR /&gt;
If &lt;CODE&gt;Agent is null&lt;/CODE&gt; - Personnel=Messagerie&lt;BR /&gt;
if &lt;CODE&gt;Agent="aa*"&lt;/CODE&gt; OR &lt;CODE&gt;Agent="bb*"&lt;/CODE&gt;(in search &lt;CODE&gt;*&lt;/CODE&gt; is wildcard, for like function in eval , % is wildcard), Personnel=AC&lt;BR /&gt;
For all other cases, Personnel=TECHNICIENS&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:44:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309377#M92792</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-17T14:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Question about eval if 4 arguments</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309378#M92793</link>
      <description>&lt;P&gt;Thanks you  Somesoni2 !!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:55:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309378#M92793</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2017-02-17T14:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Question about eval if 4 arguments</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309379#M92794</link>
      <description>&lt;P&gt;Thanks you Somesoni2 !!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:57:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-eval-if-4-arguments/m-p/309379#M92794</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2017-02-17T14:57:18Z</dc:date>
    </item>
  </channel>
</rss>

