<?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: Lookup OUTPUTNEW Behavior in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379614#M111197</link>
    <description>&lt;P&gt;When is host_name added?&lt;BR /&gt;
It does not delete the field. Just set the field to NULL.&lt;/P&gt;

&lt;P&gt;＞↓if host_name is known from source1, then keep the host_name, otherwise, ＞set it to NULL (which I hope that it will 'delete' the field)&lt;BR /&gt;
＞| eval host_name= if(host_name=="NONE", NULL, host_name)&lt;/P&gt;

&lt;P&gt;So I think that this is OK.&lt;BR /&gt;
     | lookup source1 host_ip OUTPUT host_name&lt;BR /&gt;
     | lookup source2 host_ip OUTPUTNEW host_name&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:53:03 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2020-09-29T19:53:03Z</dc:date>
    <item>
      <title>Lookup OUTPUTNEW Behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379610#M111193</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a wrong behavior on lookup command with OUTPUTNEW options.&lt;/P&gt;

&lt;P&gt;What I'm trying to achieve is to update the host_name of an asset from source2, if source1 doesn't provide a host_name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup source1 host_ip OUTPUT host_name
| eval host_name= if(host_name=="NONE", NULL, host_name)
| lookup source2 host_ip OUTPUTNEW host_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So for a specific IP, source1 provides a host_name, but I have "NONE" because source2 lookup doesn't know the host_name.&lt;/P&gt;

&lt;P&gt;This behavior seems to be incorrect if we read the Splunk documentation :&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;If the OUTPUTNEW clause is specified, the lookup is not performed for events in which the output fields already exist. &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;So source2 lookup should not be performed.&lt;/P&gt;

&lt;P&gt;Anyone has an idea about what's going on ?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379610#M111193</guid>
      <dc:creator>olivier_ma</dc:creator>
      <dc:date>2020-09-29T19:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup OUTPUTNEW Behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379611#M111194</link>
      <description>&lt;P&gt;I think that EVAL is the cause.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;↓"host_name" is added only to matching data.
 | lookup source1 host_ip OUTPUT host_name

↓"host_name" will be added to everything
 | eval host_name= if(host_name=="NONE", NULL, host_name)

↓Do not update because there is "host_name" in everything
| lookup source2 host_ip OUTPUTNEW host_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 10:42:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379611#M111194</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-06-11T10:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup OUTPUTNEW Behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379612#M111195</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm not totally agree with you :&lt;BR /&gt;
 ↓"host_name" is added if IP is known from source1&lt;BR /&gt;
  | lookup source1 host_ip OUTPUT host_name&lt;/P&gt;

&lt;P&gt;↓if host_name is known from source1, then keep the host_name, otherwise, set it to NULL (which I hope that it will 'delete' the field)&lt;BR /&gt;
  | eval host_name= if(host_name=="NONE", NULL, host_name)&lt;/P&gt;

&lt;P&gt;↓if host_name already exists, then do nothing, otherwise try to find a match&lt;BR /&gt;
 | lookup source2 host_ip OUTPUTNEW host_name&lt;/P&gt;

&lt;P&gt;This behavior it's confirmed if I use only:&lt;BR /&gt;
  | lookup source1 host_ip OUTPUT host_name&lt;BR /&gt;
  | eval host_name= if(host_name=="NONE", NULL, host_name)&lt;BR /&gt;
I have a host_name&lt;/P&gt;

&lt;P&gt;But when I add&lt;BR /&gt;
| lookup source2 host_ip OUTPUTNEW host_name&lt;BR /&gt;
I have 'NONE' as host_name which is the behavior of no match (but lookup is performed despite of 'OUTPUTNEW' clause)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:57:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379612#M111195</guid>
      <dc:creator>olivier_ma</dc:creator>
      <dc:date>2020-09-29T19:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup OUTPUTNEW Behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379613#M111196</link>
      <description>&lt;P&gt;Source 2 lookup will not “stomp” on events that already have host_name.  The lookup will still be executed however.&lt;/P&gt;

&lt;P&gt;So you should get the same results if you do the search without the eval.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 11:28:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379613#M111196</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-06-11T11:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup OUTPUTNEW Behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379614#M111197</link>
      <description>&lt;P&gt;When is host_name added?&lt;BR /&gt;
It does not delete the field. Just set the field to NULL.&lt;/P&gt;

&lt;P&gt;＞↓if host_name is known from source1, then keep the host_name, otherwise, ＞set it to NULL (which I hope that it will 'delete' the field)&lt;BR /&gt;
＞| eval host_name= if(host_name=="NONE", NULL, host_name)&lt;/P&gt;

&lt;P&gt;So I think that this is OK.&lt;BR /&gt;
     | lookup source1 host_ip OUTPUT host_name&lt;BR /&gt;
     | lookup source2 host_ip OUTPUTNEW host_name&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-OUTPUTNEW-Behavior/m-p/379614#M111197</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T19:53:03Z</dc:date>
    </item>
  </channel>
</rss>

