<?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: Search inputlookup assistance in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53249#M12940</link>
    <description>&lt;P&gt;Well lookup will throw an error if you ask it to output a field that doesn't exist in the lookup. Same thing happens if you specify a non-existent input field. I'm still not sure you're getting this completely right though. You mention using "query" as an input field - do you really have a "query" field in your data that you want to match, or are you trying to match the complete raw event data against a lookup? You need to give Splunk a SPECIFIC field to use for lookups.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jun 2013 07:55:49 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2013-06-03T07:55:49Z</dc:date>
    <item>
      <title>Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53244#M12935</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;
I've been trying to build on an existing search I've got working and find myself going around in circles and hoping for some collective experience to get to the answer.  &lt;/P&gt;

&lt;P&gt;The successful search is &lt;BR /&gt;
source="file.log" [| inputlookup domain.csv | rename HostAddress as query| fields + query ]&lt;/P&gt;

&lt;P&gt;File.log contains the source field I'm using "query" and domain.csv is a lookup I've defined.  This pulls out just the records in file.log that match on HostAddress in domain.csv.  Perfect.&lt;/P&gt;

&lt;P&gt;Where I'm pulling my hair out is that I want to pull a second column out of domain.csv and add that to the search result.  Let's call the second column "test-result".  I've read lots of articles about Lookup definitions and Automatic lookups, but these dont seem to work when I've using the inputlookup to make a subset of records.  For example, my file.log file has many hundreds of thousands of lines, but I only want the six lines that have a match to domain.csv and I want a second column from domain.csv to be returned.&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 02:15:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53244#M12935</guid>
      <dc:creator>mgoudie</dc:creator>
      <dc:date>2013-06-03T02:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53245#M12936</link>
      <description>&lt;P&gt;Well what you describe certainly sound like using the lookup file for a completely regular lookup? You got your log source with some field, and a CSV file that you want to match certain field values and output a matching other field value based on that. So, something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="file.log" [| inputlookup domain.csv | rename HostAddress as query| fields + query ] | lookup domain.csv somefield OUTPUT testresult
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Jun 2013 07:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53245#M12936</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-06-03T07:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53246#M12937</link>
      <description>&lt;P&gt;Hi Ayn, thanks for replying.  I tried this recommendation and from my query above did the following.&lt;/P&gt;

&lt;P&gt;source="file.log" [| inputlookup domain.csv | rename HostAddress as query| fields + query ] | lookup domain.csv HostAddress OUTPUT testresult&lt;/P&gt;

&lt;P&gt;The query runs OK, but I dont see any output for testresult and I get a message "Assuming implicit lookup table with filename 'domain.csv'."&lt;/P&gt;

&lt;P&gt;Just to be clear.&lt;/P&gt;

&lt;P&gt;file.log (main log file)&lt;BR /&gt;
~~~~~&lt;BR /&gt;
query&lt;BR /&gt;
[other fields]&lt;/P&gt;

&lt;P&gt;domain.csv (lookup file)&lt;BR /&gt;
~~~~~~~~~&lt;BR /&gt;
HostAddress (used to lookup on query in file.log)&lt;BR /&gt;
testresult&lt;BR /&gt;
[other fields]&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 07:15:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53246#M12937</guid>
      <dc:creator>mgoudie</dc:creator>
      <dc:date>2013-06-03T07:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53247#M12938</link>
      <description>&lt;P&gt;That message is OK. That's just because you're not referencing a lookup that's been defined in transforms.conf anywhere, just the direct filename.&lt;/P&gt;

&lt;P&gt;When you say you're looking up HostAddress, is this the actual field name in your event data? Because if it isn't this won't work - Splunk needs to know in which field it should look for the values you want to lookup.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 07:18:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53247#M12938</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-06-03T07:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53248#M12939</link>
      <description>&lt;P&gt;Hi Ayn, I just updated the headers in the lookup (CSV) file to match the field names in the LOG file and same result (ie Changed HostAddress to query in the CSV file).  It's doing something right though as if I mess up the field name of the OUTPUT statement e.g. OUTPUT nonExistant, the search errors.  I'm just not seeing output in the event window or have a selectable field in the field selector.  &lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 07:44:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53248#M12939</guid>
      <dc:creator>mgoudie</dc:creator>
      <dc:date>2013-06-03T07:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53249#M12940</link>
      <description>&lt;P&gt;Well lookup will throw an error if you ask it to output a field that doesn't exist in the lookup. Same thing happens if you specify a non-existent input field. I'm still not sure you're getting this completely right though. You mention using "query" as an input field - do you really have a "query" field in your data that you want to match, or are you trying to match the complete raw event data against a lookup? You need to give Splunk a SPECIFIC field to use for lookups.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 07:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53249#M12940</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-06-03T07:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53250#M12941</link>
      <description>&lt;P&gt;I have a field called query in my log data.  It's searchable and all that good stuff, so no problems there from what I can see.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 07:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53250#M12941</guid>
      <dc:creator>mgoudie</dc:creator>
      <dc:date>2013-06-03T07:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53251#M12942</link>
      <description>&lt;P&gt;OK. Well, given a field "query" in the event data and your lookup, and an exactly matching value, lookup WILL output a value for the specified output field, so if that's not working you have a problem somewhere. It's hard for me to say more without specific event samples, configurations and search strings.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 08:03:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53251#M12942</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-06-03T08:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search inputlookup assistance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53252#M12943</link>
      <description>&lt;P&gt;&lt;CODE&gt;|fields + query]&lt;/CODE&gt; may not be the right search for you. when the literal search is formed using this term "query" the search looks like this &lt;CODE&gt;source="file.log" (lookup1) OR (lookup2) OR (lookup3)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;you may want to look for something else like this&lt;BR /&gt;
&lt;CODE&gt;| rename HostAddress as foo| fields + foo ]&lt;/CODE&gt;&lt;BR /&gt;
this gives a litteral search like this&lt;BR /&gt;
&lt;CODE&gt;source="file.log" (foo=lookup1) OR (foo=lookup2) OR (foo=lookup3)&lt;/CODE&gt;&lt;BR /&gt;
If you want to add wildcard you can do this&lt;BR /&gt;
&lt;CODE&gt;| eval foo="*"+HostAddress+"*" | fields foo]&lt;/CODE&gt;&lt;BR /&gt;
this will give this literal search&lt;BR /&gt;
&lt;CODE&gt;source="file.log" (foo=*lookup1*) OR (foo=*lookup2*) OR (foo=*lookup3*)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2013 20:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-inputlookup-assistance/m-p/53252#M12943</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2013-06-24T20:49:30Z</dc:date>
    </item>
  </channel>
</rss>

