<?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 search to match events from a lookup not returning results with my current lookup definition and configuration? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195466#M56350</link>
    <description>&lt;P&gt;Cool.  Thanks for adding that info.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jan 2018 14:44:20 GMT</pubDate>
    <dc:creator>reswob4</dc:creator>
    <dc:date>2018-01-11T14:44:20Z</dc:date>
    <item>
      <title>Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195459#M56343</link>
      <description>&lt;P&gt;I'm sure this has been answered already, but I'm hoping if I write what I did down, someone can point out what I've missed or provide links to other suggestions.&lt;/P&gt;

&lt;P&gt;I want to create a search (which I will turn into a dashboard) that will show Microsoft events only where the user is a match for a list of users in a lookup table.  So I followed the documentation for creating a lookup table.&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addfieldsfromexternaldatasources"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addfieldsfromexternaldatasources&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/Knowledge/Addfieldsfromexternaldatasources#Step_1_-_Add_a_lookup_stanza_to_transforms.conf"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/Knowledge/Addfieldsfromexternaldatasources#Step_1_-_Add_a_lookup_stanza_to_transforms.conf&lt;/A&gt;  (and on through the other steps)&lt;/P&gt;

&lt;P&gt;So I have a csv file under $SPLUNK_HOME/etc/apps/search/lookups/users.csv &lt;/P&gt;

&lt;P&gt;The format of the file is &lt;/P&gt;

&lt;P&gt;user,"full_name"&lt;BR /&gt;
user1, "Last1, First1"&lt;BR /&gt;
user2, "Last2, First2"&lt;BR /&gt;
etc&lt;/P&gt;

&lt;P&gt;I have created a file-type lookup definition named activeusers that points to that file.&lt;/P&gt;

&lt;P&gt;Under  $SPLUNK_HOME/etc/apps/search/local I have the following transforms.conf &lt;/P&gt;

&lt;P&gt;[activeusers]&lt;BR /&gt;
filename = users.csv&lt;/P&gt;

&lt;P&gt;And under $SPLUNK_HOME/etc/apps/search/local I have the following entry in props.conf&lt;/P&gt;

&lt;P&gt;[WMI:WinEventLog:Security]&lt;BR /&gt;
LOOKUP-user = activeusers user OUTPUT full_name&lt;/P&gt;

&lt;P&gt;I put my name in the file to make sure I would get results for testing, but none of my searches get me any results.&lt;/P&gt;

&lt;P&gt;Doing a search for&lt;/P&gt;

&lt;P&gt;sourcetype="WMI:WinEventLog:Security" user=myusername &lt;/P&gt;

&lt;P&gt;shows multiple hits.  But when trying to search against the lookup tables, I constantly get No Results Found.&lt;/P&gt;

&lt;P&gt;The search I'm using is:&lt;/P&gt;

&lt;P&gt;sourcetype="WMI:WinEventLog:Security" | lookup activeusers user    (based on: &lt;A href="http://stratumsecurity.com/2012/07/03/splunk-security/"&gt;http://stratumsecurity.com/2012/07/03/splunk-security/&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;I also tried:&lt;BR /&gt;
| inputlookup users.csv | search &lt;A href="based%20on:%20http://answers.splunk.com/answers/32225/lookup-table-show-event-if-lookup-table-value-is-not-in-the-log-file.html"&gt;search sourcetype="WMI:WinEventLog:Security"&lt;/A&gt;&lt;BR /&gt;
(this takes a LONG time to run)&lt;/P&gt;

&lt;P&gt;Suggestions?  Links to better instructions? &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2014 18:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195459#M56343</guid>
      <dc:creator>reswob4</dc:creator>
      <dc:date>2014-11-04T18:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195460#M56344</link>
      <description>&lt;P&gt;Hello reswob4,&lt;/P&gt;

&lt;P&gt;I normally use the GUI interface to define the lookups, but as you're using simple CSV files, you don't even need to configure anything to use it at search time. Here some commands to help you debugging it:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Run the search on the "Search App":&lt;BR /&gt;
&lt;CODE&gt;| inputlookup users.csv&lt;/CODE&gt;&lt;BR /&gt;
If you get the lookup output, great, if you don't... something wrong with your CSV file, maybe permissions, character encoding, etc&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Having the lookuptable readable do a bit more:&lt;BR /&gt;
&lt;CODE&gt;sourcetype="WMI:WinEventLog:Security" user=myusername | lookup users.csv user&lt;/CODE&gt;&lt;BR /&gt;
&lt;EM&gt;Make sure the result from your search is returning a user value that is present in your users.csv&lt;/EM&gt;&lt;BR /&gt;
You should be able to see the event now with all additional fields extracted from the lookup table&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Let me know the results from that basic test and we should be able to continue from there if you wish to make this an automatic thing to happen.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2014 21:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195460#M56344</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2014-11-04T21:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195461#M56345</link>
      <description>&lt;P&gt;| inputlookup users.csv  returned the complete list of the csv&lt;/P&gt;

&lt;P&gt;sourcetype="WMI:WinEventLog:Security" user=myusername | lookup users.csv user  returned a list of all my events in the time period selected as well as provides the full_name field.&lt;/P&gt;

&lt;P&gt;So it appears that the basics work....&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 14:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195461#M56345</guid>
      <dc:creator>reswob4</dc:creator>
      <dc:date>2014-11-05T14:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195462#M56346</link>
      <description>&lt;P&gt;That's good... now if you wish to make this lookup an automatic thing based on the sourcetype, just go to &lt;EM&gt;Settings -&amp;gt; Lookups&lt;/EM&gt; and make sure you have the &lt;EM&gt;Lookup table files&lt;/EM&gt;, &lt;EM&gt;Lookup definitions&lt;/EM&gt; and &lt;EM&gt;Automatic lookups&lt;/EM&gt; configured.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The Lookup tables file will basically list the files you have inside the local/lookup folder per app. Just define the correct permissions&lt;/LI&gt;
&lt;LI&gt;The Lookup definitions is where you define the Name of a lookup, based on your requirements, if you just give it a name and select the right csv file you'll be OK&lt;/LI&gt;
&lt;LI&gt;And finally the Automatic lookups you associate the definition you created with a sourcetype/host/source... To configure justgive it a name,  select a lookup definition and indicate the field names on the event side and on the lookup table. In you case should be on input &lt;EM&gt;user=user&lt;/EM&gt; output &lt;EM&gt;full_name=full_name&lt;/EM&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:06:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195462#M56346</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2020-09-28T18:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195463#M56347</link>
      <description>&lt;P&gt;OK, I got it.  Thanks to musskopf for putting my on the right path.  I got the final search syntax from the Exploring Splunk book by David Carasso in the section called:  "Comparing Results to Lookup Values"&lt;/P&gt;

&lt;P&gt;sourcetype="WMI:WinEventLog:Security" [inputlookup users | fields user]&lt;/P&gt;

&lt;P&gt;produced exactly what I want.  &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 14:41:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195463#M56347</guid>
      <dc:creator>reswob4</dc:creator>
      <dc:date>2014-11-06T14:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195464#M56348</link>
      <description>&lt;P&gt;NOTE:  I'm marking this as the accepted answer, but musskopf and the book get the credit.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 14:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195464#M56348</guid>
      <dc:creator>reswob4</dc:creator>
      <dc:date>2014-11-06T14:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195465#M56349</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Beware of control characters&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;My lookup would simply not match, even though I could see that the value in the file was the same as the value returned by the initial search. &lt;/P&gt;

&lt;P&gt;This would return correct results:&lt;BR /&gt;
&lt;CODE&gt;|inputlookup details.csv |search id="xyz" |table id,description&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;This would not return any results:&lt;BR /&gt;
&lt;CODE&gt;index=_internal|head 1|eval id="xyz"|lookup details.csv id OUTPUT description|table id,description&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It turned out that my lookup file had Windows line-breaks (\r\n or CR LF) rather than Linux line-breaks (\n). Correcting this in the file and re-uploading it solved my problem.&lt;/P&gt;

&lt;P&gt;I downloaded the file and noticed that my file used windows style line-break characters (CRLF or \r\n) rather than Linux style linebreaks (&lt;EM&gt;LF&lt;/EM&gt; or &lt;EM&gt;\n&lt;/EM&gt;). I think this caused problems for Splunk because my key column was the first column in the file. Once I converted the line-breaks to Linux style ones, and re-uploaded the file, my searches worked perfectly.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:25:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195465#M56349</guid>
      <dc:creator>iaintealecapite</dc:creator>
      <dc:date>2018-01-11T14:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search to match events from a lookup not returning results with my current lookup definition and configuration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195466#M56350</link>
      <description>&lt;P&gt;Cool.  Thanks for adding that info.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-to-match-events-from-a-lookup-not-returning/m-p/195466#M56350</guid>
      <dc:creator>reswob4</dc:creator>
      <dc:date>2018-01-11T14:44:20Z</dc:date>
    </item>
  </channel>
</rss>

