<?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: How to create a lookup search for matching 2 fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414042#M119298</link>
    <description>&lt;P&gt;Recall that subsearches run before the main search.  Therefore, &lt;CODE&gt;|inputlookup mal_ip | where src=mal_ip| fields category,mal_ip,product,port&lt;/CODE&gt; must return results.  Since there is no 'src' field, the query will not return any results.  Try the following variation:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw OR index=waf | lookup mal_ip as src | fields category,mal_ip |stats count by src category
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Jun 2019 13:47:54 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-06-12T13:47:54Z</dc:date>
    <item>
      <title>How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414041#M119297</link>
      <description>&lt;P&gt;I have 2 devices: fw and waf. I want to make a lookup, my lookup file is mal_ip that has 4 fields :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mal_ip category product,port 
1.1.1.1  mal_ip    firewall  443
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to say where src=mal_ip show category, the Common field is product and port. &lt;BR /&gt;
My query is :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw OR index=waf  [ |inputlookup mal_ip | where src=mal_ip| fields category,mal_ip,product,port]|stats count by  src category
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it doesn't match any fields, can you tell me what can I do?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 07:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414041#M119297</guid>
      <dc:creator>badoomi</dc:creator>
      <dc:date>2019-06-12T07:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414042#M119298</link>
      <description>&lt;P&gt;Recall that subsearches run before the main search.  Therefore, &lt;CODE&gt;|inputlookup mal_ip | where src=mal_ip| fields category,mal_ip,product,port&lt;/CODE&gt; must return results.  Since there is no 'src' field, the query will not return any results.  Try the following variation:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw OR index=waf | lookup mal_ip as src | fields category,mal_ip |stats count by src category
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:47:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414042#M119298</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-12T13:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414043#M119299</link>
      <description>&lt;P&gt;Hi Badoomi,&lt;/P&gt;

&lt;P&gt;You're using the lookup in the wrong way to achieve your results.  &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; is &lt;EM&gt;almost&lt;/EM&gt; right in his answer:&lt;/P&gt;

&lt;PRE&gt;index=fw OR index=waf
| lookup mal_ip mal_ip as src OUTPUT category product port
| stats count by src category&lt;/PRE&gt;

&lt;P&gt;However, if you want to match more than src, and you need to check the product and the port as well it would be written as follows:&lt;/P&gt;

&lt;P&gt;&lt;PRE&gt;index=fw OR index=waf&lt;BR /&gt;
| lookup mal_ip mal_ip as src product as product port as port OUTPUT category&lt;BR /&gt;
| stats count by src category&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;This will match against src, product, and port.  But product and port have to be extracted/defined before using the &lt;CODE&gt;| lookup&lt;/CODE&gt; in that search.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:51:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414043#M119299</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2020-09-30T00:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414044#M119300</link>
      <description>&lt;P&gt;it doesn't work and show me this error:&lt;BR /&gt;
Error in 'lookup' command: Could not find all of the specified lookup fields in the lookup table.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 05:31:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414044#M119300</guid>
      <dc:creator>badoomi</dc:creator>
      <dc:date>2019-06-15T05:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414045#M119301</link>
      <description>&lt;P&gt;it doesnt work, i want to compare src from my firewall and waf with mal_ip in my lookup file&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 05:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414045#M119301</guid>
      <dc:creator>badoomi</dc:creator>
      <dc:date>2019-06-15T05:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414046#M119302</link>
      <description>&lt;P&gt;You'll need to make sure that both the lookup table (CSV file) AND the definition are created.&lt;/P&gt;

&lt;P&gt;Please refer to this:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/7.2.4/Knowledge/LookupexampleinSplunkWeb"&gt;https://docs.splunk.com/Documentation/SplunkCloud/7.2.4/Knowledge/LookupexampleinSplunkWeb&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 12:46:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414046#M119302</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-15T12:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414047#M119303</link>
      <description>&lt;P&gt;Make sure the fw and waf indexes are returning events with a field called 'src'.  If not, add &lt;CODE&gt;rename&lt;/CODE&gt; or &lt;CODE&gt;eval&lt;/CODE&gt; statements to create such a field.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 12:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414047#M119303</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-17T12:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a lookup search for matching 2 fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414048#M119304</link>
      <description>&lt;P&gt;This assumes that your &lt;CODE&gt;lookup file&lt;/CODE&gt; is referenced by a &lt;CODE&gt;lookup definition&lt;/CODE&gt; called &lt;CODE&gt;mal_ip&lt;/CODE&gt; (if not, replace the first &lt;CODE&gt;mal_ip&lt;/CODE&gt; value with the correct &lt;CODE&gt;lookup definition&lt;/CODE&gt; or &lt;CODE&gt;lookup file&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw OR index=waf
| lookup mal_ip  mal_ip AS src product port OUTPUT category
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jun 2019 21:26:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-lookup-search-for-matching-2-fields/m-p/414048#M119304</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-17T21:26:29Z</dc:date>
    </item>
  </channel>
</rss>

