<?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: Comparing lookup file with an index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681730#M232959</link>
    <description>&lt;P&gt;The lookup command should be formulated like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup activity2 &amp;lt;col_in_lookup&amp;gt; as &amp;lt;field_in_search&amp;gt; OUTPUT &amp;lt;col_in_lookup&amp;gt; as &amp;lt;field_to_output&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus your lookup command should work if the field containing the ip address value in the events is called "lb". But if you want to check if a dest ip is in the lookup, you might try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup activity2 ex_ip as dest OUTPUT ex_ip as ip_found
| search ip_found = *&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 22 Mar 2024 19:50:41 GMT</pubDate>
    <dc:creator>marnall</dc:creator>
    <dc:date>2024-03-22T19:50:41Z</dc:date>
    <item>
      <title>Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681727#M232957</link>
      <description>&lt;P&gt;I am trying to compare an IP address field called ex_ip thats stored in a lookup file with an index called activity which contains dest, src and a few other fields. I am trying to match the ex_ip from the lookup file with the dest IP from the activity index.&lt;BR /&gt;&lt;BR /&gt;My following query is not resulting in any matches. Any help would be appreciated.&lt;/P&gt;&lt;PRE&gt;index="activity" &lt;BR /&gt;|lookup activity2 ex_ip as lb OUTPUT ex_ip as match&lt;BR /&gt;|eval match=if(LIKE('dest', 'ex_ip'), 1, 0)&lt;BR /&gt;|search match=1&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 19:16:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681727#M232957</guid>
      <dc:creator>pop345</dc:creator>
      <dc:date>2024-03-22T19:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681730#M232959</link>
      <description>&lt;P&gt;The lookup command should be formulated like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup activity2 &amp;lt;col_in_lookup&amp;gt; as &amp;lt;field_in_search&amp;gt; OUTPUT &amp;lt;col_in_lookup&amp;gt; as &amp;lt;field_to_output&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus your lookup command should work if the field containing the ip address value in the events is called "lb". But if you want to check if a dest ip is in the lookup, you might try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup activity2 ex_ip as dest OUTPUT ex_ip as ip_found
| search ip_found = *&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 19:50:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681730#M232959</guid>
      <dc:creator>marnall</dc:creator>
      <dc:date>2024-03-22T19:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681747#M232966</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/266212"&gt;@pop345&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if you need to compare an ip addres from a lookup with one or more fields in the index events, you have two choices:&lt;/P&gt;&lt;P&gt;search one by one all the fields (in this example only src and dest, but you can use more fields:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="activity" 
([ | inputlookup activity2 | rename lb AS src | fields src ] OR
[ | inputlookup activity2 | rename lb AS dest | fields dest ])
| ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;search as full text:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="activity" [ | inputlookup activity2 | rename lb AS query | fields query ]
| ...&lt;/LI-CODE&gt;&lt;P&gt;with this second solution you search the lookup IPs also outside of the fields.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2024 11:23:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681747#M232966</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-23T11:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681873#M232994</link>
      <description>&lt;P&gt;I've tried this before but wasn't successful in finding any matches, hence I resorted to an eval. Anyway you can expand on the examples you provided? Is there an eval statement or search that I should be using?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 15:40:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681873#M232994</guid>
      <dc:creator>pop345</dc:creator>
      <dc:date>2024-03-25T15:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681887#M233002</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/266212"&gt;@pop345&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;what's te content od the lb field?&lt;/P&gt;&lt;P&gt;Isupposed that it's an IP address.&lt;/P&gt;&lt;P&gt;Anyway, in the first example, you should rename the lb field name to all the fields in the main search (src, dest).&lt;/P&gt;&lt;P&gt;In the second example, you perform a full text search on _raw.&lt;/P&gt;&lt;P&gt;ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 17:32:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681887#M233002</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-25T17:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681888#M233003</link>
      <description>&lt;P&gt;Yes, its an IP address.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 17:40:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681888#M233003</guid>
      <dc:creator>pop345</dc:creator>
      <dc:date>2024-03-25T17:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681889#M233004</link>
      <description>&lt;P&gt;Do I need do add anything else other than the inputlookup? I am still unsuccessful with getting a match when I know there are a ton.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 17:44:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681889#M233004</guid>
      <dc:creator>pop345</dc:creator>
      <dc:date>2024-03-25T17:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup file with an index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681904#M233009</link>
      <description>&lt;P&gt;I'm not sure why you do all this magic after the lookup command.&lt;/P&gt;&lt;PRE&gt;|lookup activity2 ex_ip as lb OUTPUT ex_ip as match&lt;/PRE&gt;&lt;P&gt;This will find a row in your lookup table activity2 for which the ex_ip value is equal to the lb value from the event. If such row is found the value from the ex_ip column (in this case it's the same column you searched by - it's a common lookup-verifying technique) is copied to the field called "match" in your result set. If there was no match the 'match' field is left empty.&lt;/P&gt;&lt;P&gt;So if you want to find only those events that matched your lookup you simply filter to find events which have a value in this field&lt;/P&gt;&lt;PRE&gt;| search match=*&lt;/PRE&gt;&lt;P&gt;It's that simple.&lt;/P&gt;&lt;P&gt;If you want to match by other field you have to specify other field(s) in your lookup.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 20:36:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-lookup-file-with-an-index/m-p/681904#M233009</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-03-25T20:36:49Z</dc:date>
    </item>
  </channel>
</rss>

