<?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: Lookups - using them to replace the host field... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12378#M1002</link>
    <description>&lt;P&gt;It's probably better to just set &lt;CODE&gt;connection_host = dns&lt;/CODE&gt; to your UDP input stanza to resolve the old behavior. The lookup script you have is rather expensive to run on every unique IP on every single search.&lt;/P&gt;

&lt;P&gt;You can not use a lookup to overwrite an incoming field value. If you really want to do this, set up a FIELDALIAS on the original field, and pass in the alias to the lookup. Again, not recommended for the long term.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Apr 2010 01:13:07 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2010-04-28T01:13:07Z</dc:date>
    <item>
      <title>Lookups - using them to replace the host field...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12377#M1001</link>
      <description>&lt;P&gt;Prior to 4.1, my host field reverse resolved (i.e. instead of ip addresses, it showed hostnames from DNS) for syslog data. This stopped when I upgraded to 4.1, so I'm trying to get it working again via lookups. I've got the lookup working when I direct the output to a new field:&lt;/P&gt;

&lt;P&gt;dnslookup ip AS host OUTPUT host AS hostname&lt;/P&gt;

&lt;P&gt;works fine, creates a new field "hostname" with the hostname data in it.&lt;/P&gt;

&lt;P&gt;But when I just do:&lt;/P&gt;

&lt;P&gt;dnslookup ip AS host OUTPUT host &lt;/P&gt;

&lt;P&gt;The host field gets eliminated. What am I missing here? I really want my data to all have consistent host fields (i.e. only hostnames where they resolve, IP addresses if they can't).&lt;/P&gt;

&lt;P&gt;Thanks
Steve&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2010 00:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12377#M1001</guid>
      <dc:creator>Steve_Litras</dc:creator>
      <dc:date>2010-04-28T00:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Lookups - using them to replace the host field...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12378#M1002</link>
      <description>&lt;P&gt;It's probably better to just set &lt;CODE&gt;connection_host = dns&lt;/CODE&gt; to your UDP input stanza to resolve the old behavior. The lookup script you have is rather expensive to run on every unique IP on every single search.&lt;/P&gt;

&lt;P&gt;You can not use a lookup to overwrite an incoming field value. If you really want to do this, set up a FIELDALIAS on the original field, and pass in the alias to the lookup. Again, not recommended for the long term.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2010 01:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12378#M1002</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-04-28T01:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Lookups - using them to replace the host field...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12379#M1003</link>
      <description>&lt;P&gt;Good call - I missed that in the doc.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2010 08:44:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12379#M1003</guid>
      <dc:creator>Steve_Litras</dc:creator>
      <dc:date>2010-04-28T08:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Lookups - using them to replace the host field...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12380#M1004</link>
      <description>&lt;P&gt;For anyone actually trying to replace host, as Steve was asking about.&lt;/P&gt;

&lt;P&gt;Here is one way to workaround the issue without doing all the &lt;CODE&gt;FIELDALIAS&lt;/CODE&gt; stuff:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;&lt;CODE&gt;... | eval ip=host | lookup dnslookup ip OUTPUT host AS hostname | eval host=coalesce(hostname,host) | eval ip=null()&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;EM&gt;If you have to use this in a number of your searches, you should consider making a macro for this&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Note that if you already have the field &lt;CODE&gt;ip&lt;/CODE&gt;, you can simply swap it out for a different (unused) field name.  This approach should allow any failed lookups to preserve their original &lt;CODE&gt;host&lt;/CODE&gt; value, which is what you want if your are dealing with a mix of hostnames and ip address in the &lt;CODE&gt;host&lt;/CODE&gt; field.&lt;/P&gt;

&lt;P&gt;If you have a small list of hosts that you are renaming (like in this example, where due to a setup issue Steve now has historical data with ip address instead of hostnames) then it probably makes more sense to make a new static lookup table (make a small .csv file in the &lt;CODE&gt;lookups&lt;/CODE&gt; directory), rather than using an external lookup script, since using a static lookup file would be much faster.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2010 22:31:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookups-using-them-to-replace-the-host-field/m-p/12380#M1004</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-04-30T22:31:16Z</dc:date>
    </item>
  </channel>
</rss>

