<?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 a value is not in a lookup table, can I return that value as the OUTPUT field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250097#M74666</link>
    <description>&lt;P&gt;Hi @j_partsch&lt;/P&gt;

&lt;P&gt;Glad you found an answer to your question through @ntaylorsplunk &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Please don't forget to resolve the post by clicking "Accept" directly below the answer. &lt;/P&gt;

&lt;P&gt;I noticed you gave sundareshr a downvote for his attempted answer, but please note that for voting etiquette in this forum, it's best to only use downvoting for answers/suggestions that could potentially do harm to your environment. If an answer is helpful, it's encouraged to upvote it and that will already bump it up in the list of answers. If an attempted answer didn't get you what you needed, then no need to downvote someone for simply trying to help you out. We want to encourage community oriented behavior, not deter people from trying to help. &lt;/P&gt;

&lt;P&gt;For more info in how voting etiquette works in this community, feel free to check out the discussion on this previous Splunk Answers post.&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html"&gt;https://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2016 22:50:24 GMT</pubDate>
    <dc:creator>ppablo</dc:creator>
    <dc:date>2016-08-30T22:50:24Z</dc:date>
    <item>
      <title>If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250091#M74660</link>
      <description>&lt;P&gt;I apologize if this has already been answered, but I looked through numerous inquiries on answers.splunk.com and did not find one to match my issue.  I have a CSV lookup table of CustID, CustName, src_ip.  I am charting the top 10 accesses by scr_ip over a time period. If the src_ip is in the lookup table, I want to display the CustName, else display src_ip.  &lt;/P&gt;

&lt;P&gt;CustID,CustName,src_ip&lt;BR /&gt;
99999,Customer1,123.123.123.123&lt;BR /&gt;
88888,Customer2,123.45.67.8&lt;BR /&gt;
77777, Customer3,123.67.8.3&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;This is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined | lookup TestIPs.csv src_ip OUTPUT CustName | chart count over CustName| sort -count limit=10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This results in a chart of only the Customer hits, but  does not show any information from hits from non-customers. Theoretically, non-customer could be in the top 10 site users.&lt;/P&gt;

&lt;P&gt;Sample Output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CustName     count
Customer3    10
Customer1    6
Customer2    3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Desired Output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CustName          count
111.222.333.4     20
1.2.3.4           15
Customer3         10
4.9.1.6           7
Customer1         6
Customer2         3
1.1.1.1           2
1.2.3.45          1
2.3.4.5           1
3.5.7.9           1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:45:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250091#M74660</guid>
      <dc:creator>j_partsch</dc:creator>
      <dc:date>2020-09-29T10:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250092#M74661</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined | lookup TestIPs.csv src_ip OUTPUT CustName | eval CustName=coalesce(CustName, src_ip) | chart count over CustName| sort -count limit=10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Aug 2016 16:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250092#M74661</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-25T16:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250093#M74662</link>
      <description>&lt;P&gt;This did not work, every record shows src_ip in the CustName field now including for customers,  there are no customer names shown.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 16:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250093#M74662</guid>
      <dc:creator>j_partsch</dc:creator>
      <dc:date>2016-08-25T16:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250094#M74663</link>
      <description>&lt;P&gt;Try this instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined | lookup TestIPs.csv src_ip OUTPUT CustName | eval CustName=if(len(CustName) &amp;gt; 2, CustName, src_ip) | chart count over CustName| sort -count limit=10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Aug 2016 17:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250094#M74663</guid>
      <dc:creator>ntaylorsplunk</dc:creator>
      <dc:date>2016-08-25T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250095#M74664</link>
      <description>&lt;P&gt;This works!  Thank you very much ntaylorsplunk!!!!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 17:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250095#M74664</guid>
      <dc:creator>j_partsch</dc:creator>
      <dc:date>2016-08-25T17:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250096#M74665</link>
      <description>&lt;P&gt;I downvoted this post because this did not work, every record shows src_ip in the custname field now including for customers, there are no customer names shown.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 17:33:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250096#M74665</guid>
      <dc:creator>j_partsch</dc:creator>
      <dc:date>2016-08-25T17:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250097#M74666</link>
      <description>&lt;P&gt;Hi @j_partsch&lt;/P&gt;

&lt;P&gt;Glad you found an answer to your question through @ntaylorsplunk &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Please don't forget to resolve the post by clicking "Accept" directly below the answer. &lt;/P&gt;

&lt;P&gt;I noticed you gave sundareshr a downvote for his attempted answer, but please note that for voting etiquette in this forum, it's best to only use downvoting for answers/suggestions that could potentially do harm to your environment. If an answer is helpful, it's encouraged to upvote it and that will already bump it up in the list of answers. If an attempted answer didn't get you what you needed, then no need to downvote someone for simply trying to help you out. We want to encourage community oriented behavior, not deter people from trying to help. &lt;/P&gt;

&lt;P&gt;For more info in how voting etiquette works in this community, feel free to check out the discussion on this previous Splunk Answers post.&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html"&gt;https://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 22:50:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250097#M74666</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2016-08-30T22:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250098#M74667</link>
      <description>&lt;P&gt;Thank you for the pointers.  I was unaware of the proper-etiquette on answers.splunk.com.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 11:47:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250098#M74667</guid>
      <dc:creator>j_partsch</dc:creator>
      <dc:date>2016-08-31T11:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: If a value is not in a lookup table, can I return that value as the OUTPUT field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250099#M74668</link>
      <description>&lt;P&gt;No problem. Glad you got the help you needed from the community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 00:11:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-a-value-is-not-in-a-lookup-table-can-I-return-that-value-as/m-p/250099#M74668</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2016-09-13T00:11:55Z</dc:date>
    </item>
  </channel>
</rss>

