<?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 value then string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373500#M162953</link>
    <description>&lt;P&gt;are you trying like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|Eval name=if(ID=“XYZ”,”Unknown”, name)| fillnull value=Unknown
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 Feb 2018 15:13:56 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-02-12T15:13:56Z</dc:date>
    <item>
      <title>IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373498#M162951</link>
      <description>&lt;P&gt;I am trying to set the Name to Unknown if the ID is XYZ else populate it with the name value.&lt;/P&gt;

&lt;P&gt;I have &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Eval name=if(ID=“XYZ”,”Unknown”, name)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am getting the name as Null even when I have a fillnull function to change Nulls to Unknown.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;TIA!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:04:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373498#M162951</guid>
      <dc:creator>dlcrooks</dc:creator>
      <dc:date>2018-02-12T15:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373499#M162952</link>
      <description>&lt;P&gt;I'm not sure to understand your question, when do you have null ?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:08:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373499#M162952</guid>
      <dc:creator>isabel_ycourbe</dc:creator>
      <dc:date>2018-02-12T15:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373500#M162953</link>
      <description>&lt;P&gt;are you trying like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|Eval name=if(ID=“XYZ”,”Unknown”, name)| fillnull value=Unknown
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:13:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373500#M162953</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-12T15:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373501#M162954</link>
      <description>&lt;P&gt;If I understand you question correctly, you have cases where ID="XYZ" but you name is null. In that case you need to use &lt;CODE&gt;| fillnull value="" name&lt;/CODE&gt; before your eval to make sure your names are at least blank (otherwise by default it will be unset hence &lt;CODE&gt;null&lt;/CODE&gt;). &lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373501#M162954</guid>
      <dc:creator>isabel_ycourbe</dc:creator>
      <dc:date>2018-02-12T15:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373502#M162955</link>
      <description>&lt;P&gt;is this a direct copy of the search string you're using?   Try using 'straight' quotes, rather than 'curly' ones:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Eval name2=if(ID="XYZ","Unknown", name)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373502#M162955</guid>
      <dc:creator>philipmattocks</dc:creator>
      <dc:date>2018-02-12T15:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373503#M162956</link>
      <description>&lt;P&gt;Yes, and still no luck&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373503#M162956</guid>
      <dc:creator>dlcrooks</dc:creator>
      <dc:date>2018-02-12T15:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373504#M162957</link>
      <description>&lt;P&gt;You need to do the opposite, first fill nulls, then do your eval.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:01:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373504#M162957</guid>
      <dc:creator>isabel_ycourbe</dc:creator>
      <dc:date>2018-02-12T16:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373505#M162958</link>
      <description>&lt;P&gt;I put the if statement at the end and it works.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:10:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373505#M162958</guid>
      <dc:creator>dlcrooks</dc:creator>
      <dc:date>2018-02-12T16:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373506#M162959</link>
      <description>&lt;P&gt;Why doesn’t the IF statement work?  I should not have to use the Fillnull!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:15:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373506#M162959</guid>
      <dc:creator>dlcrooks</dc:creator>
      <dc:date>2018-02-12T16:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373507#M162960</link>
      <description>&lt;P&gt;It actually works as expected, don't forget that splunk will run your pipes one by one, searches is not compiled.&lt;/P&gt;

&lt;P&gt;If we take this search&lt;BR /&gt;
(1) &lt;BR /&gt;
(2) | eval name=if(id="xyz", "unknown", name)&lt;/P&gt;

&lt;P&gt;At (1) your field &lt;CODE&gt;name&lt;/CODE&gt; will only exists where there is a value, for all rows, it will not be blank, it will not exist and hence be null so at step (2) you will assign null to you field name&lt;/P&gt;

&lt;P&gt;If you add a fill null between&lt;/P&gt;

&lt;P&gt;(1) &lt;BR /&gt;
(2) | fillnull value="" name&lt;BR /&gt;
(3) | eval name=if(id="xyz", "unknown", name)&lt;/P&gt;

&lt;P&gt;now at step (2) you field name exist and is set to blank (or whatever value you set).&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:21:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373507#M162960</guid>
      <dc:creator>isabel_ycourbe</dc:creator>
      <dc:date>2018-02-12T16:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373508#M162961</link>
      <description>&lt;P&gt;No, I using the correct quotes&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 17:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373508#M162961</guid>
      <dc:creator>dlcrooks</dc:creator>
      <dc:date>2018-02-12T17:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373509#M162962</link>
      <description>&lt;P&gt;if you could share sample inputs to understand better&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 17:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373509#M162962</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-12T17:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373510#M162963</link>
      <description>&lt;P&gt;No joy.   The name field is still blank as IF statement is not working.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 17:42:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373510#M162963</guid>
      <dc:creator>dlcrooks</dc:creator>
      <dc:date>2018-02-12T17:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: IF value then string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373511#M162964</link>
      <description>&lt;P&gt;Can you provide a small dataset ?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 08:10:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/IF-value-then-string/m-p/373511#M162964</guid>
      <dc:creator>isabel_ycourbe</dc:creator>
      <dc:date>2018-02-13T08:10:53Z</dc:date>
    </item>
  </channel>
</rss>

