<?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: Why is my lookup search query not returning expected results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157560#M44344</link>
    <description>&lt;P&gt;Thanks for the input.  None of the modified scripts work.  They all output blank URI_Keyword and URI_KeywordType fields.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 17:50:42 GMT</pubDate>
    <dc:creator>mistergreen28</dc:creator>
    <dc:date>2020-09-28T17:50:42Z</dc:date>
    <item>
      <title>Why is my lookup search query not returning expected results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157558#M44342</link>
      <description>&lt;P&gt;I've got a KeywordList.csv lookup table with 3 columns (URI, URI_Keyword, URI_KeywordType).  URI is a pre-existing field in our log data, while URI_Keyword and URI_KeywordType are new fields that I'd like to enrich our events with.  I've created a file based lookup (KeywordList) definition that is used in the same app context &amp;amp; permissions as the KeywordList.csv.&lt;/P&gt;

&lt;P&gt;What I'm trying to do is search our URI field with the keywords from the URI field in the lookup table, and then output corresponding URI_Keyword and URI_KeywordType field data for those events.&lt;/P&gt;

&lt;P&gt;My script below brings back a table that has blank URI_Keyword and URI_KeywordType fields.&lt;/P&gt;

&lt;P&gt;index=tmg | search [|inputlookup KeywordList.csv | fields URI] | lookup KeywordList URI OUTPUTNEW URI_Keyword, URI_KeywordType | table URI_Keyword, URI_KeywordType, URI&lt;/P&gt;

&lt;P&gt;When removing he "| fields URI" piece from the subsearch, I get no results.&lt;/P&gt;

&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:50:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157558#M44342</guid>
      <dc:creator>mistergreen28</dc:creator>
      <dc:date>2020-09-28T17:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my lookup search query not returning expected results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157559#M44343</link>
      <description>&lt;P&gt;try if one of these works for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tmg | search [|inputlookup KeywordList.csv | fields URI] | lookup KeywordList URI OUTPUT URI_Keyword, URI_KeywordType | table URI_Keyword, URI_KeywordType, URI

index=tmg | search [|inputlookup KeywordList.csv | fields URI] | lookup KeywordList URI | table URI_Keyword, URI_KeywordType, URI

index=tmg | lookup KeywordList URI | table URI_Keyword, URI_KeywordType, URI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sorry I wrote a longer answer, but lost everything because of my browser, so this short answer is all you get from me at the moment.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2014 16:37:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157559#M44343</guid>
      <dc:creator>peter_krammer</dc:creator>
      <dc:date>2014-10-09T16:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my lookup search query not returning expected results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157560#M44344</link>
      <description>&lt;P&gt;Thanks for the input.  None of the modified scripts work.  They all output blank URI_Keyword and URI_KeywordType fields.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:50:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157560#M44344</guid>
      <dc:creator>mistergreen28</dc:creator>
      <dc:date>2020-09-28T17:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my lookup search query not returning expected results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157561#M44345</link>
      <description>&lt;P&gt;You are misunderstanding what this portion does:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... [|inputlookup KeywordList.csv | fields URI] ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try typing this into your search bar:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup KeywordList.csv | fields URI | format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then try it without &lt;CODE&gt;| fields URL&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup KeywordList.csv | format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you should understand that the first part of your search should probably be this (which does the same thing that you have, but more clearly and efficiently):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tmg [|inputlookup KeywordList.csv | fields URI] | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you should be able to take it from there (I am not sure what your end-game is).&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2015 05:58:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-lookup-search-query-not-returning-expected-results/m-p/157561#M44345</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-17T05:58:57Z</dc:date>
    </item>
  </channel>
</rss>

