<?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: Set Field=Value when Field not present in some logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347189#M159536</link>
    <description>&lt;P&gt;Heya, or try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fillnull value=none field1,field2,field3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Aug 2017 14:25:23 GMT</pubDate>
    <dc:creator>alemarzu</dc:creator>
    <dc:date>2017-08-03T14:25:23Z</dc:date>
    <item>
      <title>Set Field=Value when Field not present in some logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347187#M159534</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am running a search that in some cases has:&lt;BR /&gt;
Field=Values&lt;/P&gt;

&lt;P&gt;In other cases, Field is completely missing from logs (this is expected).&lt;/P&gt;

&lt;P&gt;What would be the best way to set Field equal to the Value when one is present, but if the Field does not exist in a given log line, Field should be set to the word "none"?&lt;/P&gt;

&lt;P&gt;I've tried the coalesce command, but it doesn't seem to be working - maybe it is just being used incorrectly?&lt;BR /&gt;
eval NewField=coalesce(Field,"none")&lt;/P&gt;

&lt;P&gt;In the above example, NewField is always equal to "none" - even when Field includes a value.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 14:10:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347187#M159534</guid>
      <dc:creator>bcarr12</dc:creator>
      <dc:date>2017-08-03T14:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Field=Value when Field not present in some logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347188#M159535</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval Field=if(isnull(Field),"none",Field)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Aug 2017 14:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347188#M159535</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-03T14:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set Field=Value when Field not present in some logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347189#M159536</link>
      <description>&lt;P&gt;Heya, or try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fillnull value=none field1,field2,field3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Aug 2017 14:25:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347189#M159536</guid>
      <dc:creator>alemarzu</dc:creator>
      <dc:date>2017-08-03T14:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set Field=Value when Field not present in some logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347190#M159537</link>
      <description>&lt;P&gt;Thank you both for your suggestions!  alemarzu, fillnull worked great for this!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 14:46:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-Field-Value-when-Field-not-present-in-some-logs/m-p/347190#M159537</guid>
      <dc:creator>bcarr12</dc:creator>
      <dc:date>2017-08-03T14:46:52Z</dc:date>
    </item>
  </channel>
</rss>

