<?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: Using a lookup for search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413623#M170762</link>
    <description>&lt;P&gt;Hi cthulhucalling,&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d index=web [| inputlookup web_attack_sigs.csv | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;by using &lt;CODE&gt;format&lt;/CODE&gt; you will get a list of &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( ( uri_path="*/etc/passwd*" AND description ="Passwd file access attempt" ) OR ( uri_path="*phpadmin*" AND description ="PHPadmin access attempt" ) )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will be added to your base search. More details here &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Format"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Format&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 00:55:52 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2019-06-12T00:55:52Z</dc:date>
    <item>
      <title>Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413622#M170761</link>
      <description>&lt;P&gt;I have a small CSV file with common attack signatures in them that I have uploaded as a lookup called web_attack_signatures.csv:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;uri_path, description
*/etc/passwd*, Passwd file access attempt
*phpadmin*, PHPadmin access attempt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ignoring the fact that these signatures are inefficient, the idea is that the lookup feeds the search, looking for any attack signature matches matches in my web logs. The relevant field in my logs is also called uri_path. So far I have been able to pull relevant events using this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d index=web [| inputlookup web_attack_sigs.csv | fields uri_path]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I cannot get get the description field to be added to the results. I've tried adding "description" to the fields command with 0 results, and tried piping the events to another lookup command but that didn't work either. Can anyone help?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:51:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413622#M170761</guid>
      <dc:creator>cthulhucalling</dc:creator>
      <dc:date>2020-09-30T00:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413623#M170762</link>
      <description>&lt;P&gt;Hi cthulhucalling,&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d index=web [| inputlookup web_attack_sigs.csv | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;by using &lt;CODE&gt;format&lt;/CODE&gt; you will get a list of &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( ( uri_path="*/etc/passwd*" AND description ="Passwd file access attempt" ) OR ( uri_path="*phpadmin*" AND description ="PHPadmin access attempt" ) )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will be added to your base search. More details here &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Format"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Format&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 00:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413623#M170762</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-06-12T00:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413624#M170763</link>
      <description>&lt;P&gt;I tried this query. Unfortunately, it returned 0 results.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413624#M170763</guid>
      <dc:creator>cthulhucalling</dc:creator>
      <dc:date>2019-06-12T13:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413625#M170764</link>
      <description>&lt;P&gt;When adding the description to the output of the subsearch, it will also use that for filtering, which is not what you want. If I understand correctly, you want to filter the events for the signatures and then add the description to the results, right?&lt;/P&gt;

&lt;P&gt;I think the following should work (might require some configuration change on your lookup, to enable wildcard matches):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d index=web 
| lookup web_attack_sigs.csv uri_path OUTPUT description
| search description=*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Possibly the search runs more quickly if you keep the subsearch to do the initial filtering:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d index=web [| inputlookup web_attack_sigs.csv | fields uri_path]
| lookup web_attack_sigs.csv uri_path OUTPUT description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413625#M170764</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-12T14:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413626#M170765</link>
      <description>&lt;P&gt;The first query returns anything with "description" in the event. The second one I had tried yesterday. It returns relevant results but the description line is not being added to the events.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413626#M170765</guid>
      <dc:creator>cthulhucalling</dc:creator>
      <dc:date>2019-06-12T14:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413627#M170766</link>
      <description>&lt;P&gt;The issue appears to be that I'm wildcarding the signatures. If I change &lt;EM&gt;/etc/passwd&lt;/EM&gt; to just /etc/passwd, I do get the description when  I do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d index=web [| inputlookup web_attack_sigs.csv | fields uri_path]
| lookup web_attack_sigs.csv uri_path OUTPUT description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm guessing that because of the wildcards, it's not an exact match when the lookup occurs, so it's not a hit and the description isn't added. The issue is that I get only results where the request is exactly for /etc/passwd.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:33:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413627#M170766</guid>
      <dc:creator>cthulhucalling</dc:creator>
      <dc:date>2019-06-12T14:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413628#M170767</link>
      <description>&lt;P&gt;Did you configure your lookup to allow wildcard matches on the uri_path field? Otherwise the lookup command will not work as expected.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:38:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413628#M170767</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-12T14:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413629#M170768</link>
      <description>&lt;P&gt;I don't have shell access to that particular search head, so I can't do that.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:42:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413629#M170768</guid>
      <dc:creator>cthulhucalling</dc:creator>
      <dc:date>2019-06-12T14:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413630#M170769</link>
      <description>&lt;P&gt;You can configure that in the GUI in the advanced options of a lookup definition.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:53:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413630#M170769</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-12T14:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413631#M170770</link>
      <description>&lt;P&gt;Adding WILDCARD(uri_path) to the lookup definition did the trick! Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 15:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413631#M170770</guid>
      <dc:creator>cthulhucalling</dc:creator>
      <dc:date>2019-06-12T15:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413632#M170771</link>
      <description>&lt;P&gt;Hi @cthulhucalling ,&lt;/P&gt;

&lt;P&gt;As some of the others have said, you can have wildcards in your lookups, but you have to specify it in the advanced settings in the web interface (UI).  Here is an example of how you would do that:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7176i8A5CEE74CD53E44F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Once you have the lookup configured, you can use the following search logic:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup web_attack_sigs uri_path OUTPUT description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is what it looks like:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7177iBAB5A215CCB55517/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 19:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413632#M170771</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-12T19:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup for search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413633#M170772</link>
      <description>&lt;P&gt;Well, it also looks like I completely misunderstood your question &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Sorry for that.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 20:25:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-lookup-for-search/m-p/413633#M170772</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-06-12T20:25:29Z</dc:date>
    </item>
  </channel>
</rss>

