<?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: After setting up and defining a CSV lookup in Splunk, why is lookup returning a field with blank values in search results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278971#M84254</link>
    <description>&lt;P&gt;All were correct - turns out it was an issue with the lookup table data as summarised in the answer below &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 23:54:34 GMT</pubDate>
    <dc:creator>alexandermunce</dc:creator>
    <dc:date>2016-12-19T23:54:34Z</dc:date>
    <item>
      <title>After setting up and defining a CSV lookup in Splunk, why is lookup returning a field with blank values in search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278967#M84250</link>
      <description>&lt;P&gt;I have set up a lookup CSV which looks something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;product, meaningful_product
product_1, "Meaningful Name 1"
product_2, "Meaningful Name 2"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;etc..&lt;BR /&gt;
I have added the lookup file to the Splunk Lookup Table files as below;&lt;/P&gt;

&lt;P&gt;/opt/splunk/etc/apps/search/lookups/product_names.csv&lt;/P&gt;

&lt;P&gt;I have added a Lookup Definition for the CSV as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Name                  Type      Supported Fields
vgate_prod_names      file      product,meaningful_product
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now that I have completed all of the above steps, I am testing this in one of my searches in a similar method to the below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | lookup vgate_prod_names product AS product OUTPUT meaningful_product AS product | more search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have also tried this syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | lookup vgate_prod_names product OUTPUT meaningful_product AS product | more search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However in both instances, the search returns all of the results it should, however the &lt;STRONG&gt;product&lt;/STRONG&gt; field contains &lt;STRONG&gt;only blank values&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;Side note - if I am to run the following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; search query | lookup vgate_prod_names product OUTPUTNEW meaningful_product AS product_new | more search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which in the above, product_new is a new field name - my search returns a new field named product_new with all of the values which I was expecting to be set for the product field.&lt;/P&gt;

&lt;P&gt;Does there need to be a lookup value in my CSV lookup table for EVERY possible value that can be returned in the product field?&lt;/P&gt;

&lt;P&gt;To generate my product field value list I generated a count of all product field values for the year to date - I suppose there may be some fields which were not returned in this original search. Any way around this? The search took some time obviously.&lt;/P&gt;

&lt;P&gt;What am I doing wrong??&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278967#M84250</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2020-09-29T12:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: After setting up and defining a CSV lookup in Splunk, why is lookup returning a field with blank values in search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278968#M84251</link>
      <description>&lt;P&gt;Yes, if you're overriding existing field name, and there is no match, it'll overwrite that field with null. A better approach will be like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | lookup vgate_prod_names product AS product OUTPUT meaningful_product AS product_new | eval product=coalesce(product_new,product) | fields - product_new | more search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Dec 2016 22:33:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278968#M84251</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-13T22:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: After setting up and defining a CSV lookup in Splunk, why is lookup returning a field with blank values in search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278969#M84252</link>
      <description>&lt;P&gt;check with " | inputlookup name_lookupfile " is the file correct readed.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 10:17:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278969#M84252</guid>
      <dc:creator>amielke</dc:creator>
      <dc:date>2016-12-14T10:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: After setting up and defining a CSV lookup in Splunk, why is lookup returning a field with blank values in search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278970#M84253</link>
      <description>&lt;P&gt;With some guidance from the comments above I have been able to resolve my original issue and implement a working solution.&lt;/P&gt;

&lt;P&gt;The reason that all lookup OUTPUT values for the &lt;STRONG&gt;product&lt;/STRONG&gt; field were being returned as NULL is due to the fact that the CSV lookup table did not contain ALL possible values for the product field that were returned by my search - and also did not cater for any NULL values.&lt;/P&gt;

&lt;P&gt;By implementing the following commands into my search query I have been able to successfully return the replacement lookup values into the correct field (&lt;STRONG&gt;product&lt;/STRONG&gt;).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lookup vgate_prod_names product as product OUTPUT meaningful_product | eval product=coalesce(meaningful_product,product) | fields - meaningful_product
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Above I am looking up the &lt;STRONG&gt;product&lt;/STRONG&gt; field values against the list of values in the product column of my CSV file, and for any match, I am returning the value from the meaningful_product column of the CSV as a new field named &lt;STRONG&gt;meaningful_product&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;Then to address the original issue of simplifying the value names in the &lt;STRONG&gt;product&lt;/STRONG&gt; field, I am using the &lt;EM&gt;eval&lt;/EM&gt; command against the &lt;STRONG&gt;product&lt;/STRONG&gt; field combined with the &lt;EM&gt;coalesce&lt;/EM&gt; function which will replace any value of the product field with associated &lt;STRONG&gt;meaningful_product&lt;/STRONG&gt; value, or if there is no match/null, then replacing with the original &lt;STRONG&gt;product&lt;/STRONG&gt; value.&lt;/P&gt;

&lt;P&gt;The fact that some values of the &lt;STRONG&gt;product&lt;/STRONG&gt; field remain unchanged is a non issue in my case as this will equate to &amp;lt;1% of the result data.&lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:07:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278970#M84253</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2020-09-29T12:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: After setting up and defining a CSV lookup in Splunk, why is lookup returning a field with blank values in search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278971#M84254</link>
      <description>&lt;P&gt;All were correct - turns out it was an issue with the lookup table data as summarised in the answer below &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 23:54:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/After-setting-up-and-defining-a-CSV-lookup-in-Splunk-why-is/m-p/278971#M84254</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-19T23:54:34Z</dc:date>
    </item>
  </channel>
</rss>

