<?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 and if commands return unexpected result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272707#M82109</link>
    <description>&lt;P&gt;Beautiful thing !!! it works -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval tin_provider=if(like(source,"%part-m-00009%"),"XXXX","ccccc")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Apr 2016 00:23:24 GMT</pubDate>
    <dc:creator>ddrillic</dc:creator>
    <dc:date>2016-04-04T00:23:24Z</dc:date>
    <item>
      <title>Eval and if commands return unexpected result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272704#M82106</link>
      <description>&lt;P&gt;The question relates to &lt;A href="https://answers.splunk.com/answers/387510/alternatives-to-using-join-command.html"&gt;https://answers.splunk.com/answers/387510/alternatives-to-using-join-command.html&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=provider source="*part-m-00009*" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns events that belong to a scoop file which contains a part-m-00009 string in its name. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=provider source="*part-m-00009*")
 | eval tin_provider=if(source="*part-m-00009*","XXXX","ccccc")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns ccccc for the tin_provider field.&lt;/P&gt;

&lt;P&gt;Does it make sense?&lt;/P&gt;

&lt;P&gt;I'm also trying  -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval tin_provider=if(source=="*part-m-00009*","XXXX","ccccc")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Meaning, double equal with the same results, which is also weird. &lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 21:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272704#M82106</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-04-03T21:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Eval and if commands return unexpected result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272705#M82107</link>
      <description>&lt;P&gt;hmm i wonder if the quotes around the source in your eval if is causing it to literally look for source containing asterisk...will test and let you know...&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 21:34:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272705#M82107</guid>
      <dc:creator>mattymo</dc:creator>
      <dc:date>2016-04-03T21:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Eval and if commands return unexpected result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272706#M82108</link>
      <description>&lt;P&gt;The operator &lt;CODE&gt;=&lt;/CODE&gt; has different meaning in the &lt;CODE&gt;search&lt;/CODE&gt; command (wildcard matching) and the &lt;CODE&gt;eval&lt;/CODE&gt; command (equality).&lt;/P&gt;

&lt;P&gt;To get wildcard matching in &lt;CODE&gt;eval&lt;/CODE&gt;, you can use &lt;CODE&gt;match()&lt;/CODE&gt; with regular expressions, &lt;CODE&gt;like()&lt;/CODE&gt; with SQL-style wildcards, or &lt;CODE&gt;searchmatch()&lt;/CODE&gt; to get asterisk wildcards like in the &lt;CODE&gt;search&lt;/CODE&gt; command. Check out &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions&lt;/A&gt; for more info.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 21:47:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272706#M82108</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2016-04-03T21:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Eval and if commands return unexpected result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272707#M82109</link>
      <description>&lt;P&gt;Beautiful thing !!! it works -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval tin_provider=if(like(source,"%part-m-00009%"),"XXXX","ccccc")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Apr 2016 00:23:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-if-commands-return-unexpected-result/m-p/272707#M82109</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-04-04T00:23:24Z</dc:date>
    </item>
  </channel>
</rss>

