<?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 Why is Lookup command not working? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/647954#M224226</link>
    <description>&lt;P&gt;Hi Splunkers, I have an issue with a search that use a lookup. I know here on community there are a lots of post on this argument, but event reading them I'm still in struck.&lt;BR /&gt;My search must simple match this: verify if, from firewall logs, the destination ip match against the address contained on a lookup file and traffic is accepted/permitted.&lt;/P&gt;
&lt;P&gt;The search is:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=* sourcetype=cp_log direction=outbound action="Accept" 
| lookup tor_node tor_node_address as dst_ip output exclude 
| where isnull(exclude) 
| stats count by src_ip, dst_ip&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the table name is &lt;STRONG&gt;tor_node&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;this table has 2 columns: &lt;STRONG&gt;tor_node_address&lt;/STRONG&gt;, which contains ip address, and &lt;STRONG&gt;exclude&lt;/STRONG&gt;, inserted to esclude temporary some IPs from matching if needed.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;So, the query logic is: check if, in the events, the dst_ip field values match the lookup field named tor_node address ones and, with the use of isnull command, those IP are not marked with exclusion.&lt;BR /&gt;&lt;BR /&gt;How I want to check if the value in the lookup must be excluded from matching or not?&lt;BR /&gt;If the cell of &lt;STRONG&gt;exclude&lt;/STRONG&gt; column is empty, the row must be included in check; if it is populated, not.&lt;BR /&gt;So, if the &lt;STRONG&gt;exclude&lt;/STRONG&gt; column &lt;STRONG&gt;is full empty, all data of tor_node_address must be matched by dst_ip.&lt;BR /&gt;&lt;/STRONG&gt;That means that, if no dst_ip match&amp;nbsp;tor_node_address, the search resut must be empty.&lt;BR /&gt;&lt;BR /&gt;Here a graphical view of my lookup:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_0-1687446941150.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25952i6EADE8AA4413D44E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_0-1687446941150.png" alt="SplunkExplorer_0-1687446941150.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see, the table has been created with&amp;nbsp;&lt;A title="Splunk App for Lookup File Editing" href="https://splunkbase.splunk.com/app/1724" target="_self"&gt;https://splunkbase.splunk.com/app/1724&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ensured that, after saving file, the lookup is well populated with &lt;STRONG&gt;inputlookup&lt;/STRONG&gt; command:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_1-1687447088747.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25953i33BF735E09E55DEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_1-1687447088747.png" alt="SplunkExplorer_1-1687447088747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I changed correctly lookup file permissions:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_2-1687447170289.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25954i3AEF8641B25B1EA7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_2-1687447170289.png" alt="SplunkExplorer_2-1687447170289.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_3-1687447190984.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25955iE79B3399B0A8202D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_3-1687447190984.png" alt="SplunkExplorer_3-1687447190984.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I created the related lookup definition and set correctly its permission:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_4-1687447278055.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25956i6345971F111946C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_4-1687447278055.png" alt="SplunkExplorer_4-1687447278055.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_5-1687447292699.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25957iA335FA67F5096D61/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_5-1687447292699.png" alt="SplunkExplorer_5-1687447292699.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And set no particular advanced settings, except avoid case sensitive match:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_6-1687447361542.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25958i0407322AEF457987/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_6-1687447361542.png" alt="SplunkExplorer_6-1687447361542.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So, what's the problem?&lt;BR /&gt;The search dos not perform the check.&lt;BR /&gt;Even if no dst_ip match the&amp;nbsp;tor_node_address one,&lt;STRONG&gt; the search result is not empty.&lt;/STRONG&gt;&lt;BR /&gt;If I launch it, I can see the same results gained with:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=* sourcetype=cp_log direction=outbound action="Accept" 
| stats count by src_ip, dst_ip&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It seems like the lookup command is totally ignored.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2023 17:55:13 GMT</pubDate>
    <dc:creator>SplunkExplorer</dc:creator>
    <dc:date>2023-06-22T17:55:13Z</dc:date>
    <item>
      <title>Why is Lookup command not working?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/647954#M224226</link>
      <description>&lt;P&gt;Hi Splunkers, I have an issue with a search that use a lookup. I know here on community there are a lots of post on this argument, but event reading them I'm still in struck.&lt;BR /&gt;My search must simple match this: verify if, from firewall logs, the destination ip match against the address contained on a lookup file and traffic is accepted/permitted.&lt;/P&gt;
&lt;P&gt;The search is:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=* sourcetype=cp_log direction=outbound action="Accept" 
| lookup tor_node tor_node_address as dst_ip output exclude 
| where isnull(exclude) 
| stats count by src_ip, dst_ip&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the table name is &lt;STRONG&gt;tor_node&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;this table has 2 columns: &lt;STRONG&gt;tor_node_address&lt;/STRONG&gt;, which contains ip address, and &lt;STRONG&gt;exclude&lt;/STRONG&gt;, inserted to esclude temporary some IPs from matching if needed.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;So, the query logic is: check if, in the events, the dst_ip field values match the lookup field named tor_node address ones and, with the use of isnull command, those IP are not marked with exclusion.&lt;BR /&gt;&lt;BR /&gt;How I want to check if the value in the lookup must be excluded from matching or not?&lt;BR /&gt;If the cell of &lt;STRONG&gt;exclude&lt;/STRONG&gt; column is empty, the row must be included in check; if it is populated, not.&lt;BR /&gt;So, if the &lt;STRONG&gt;exclude&lt;/STRONG&gt; column &lt;STRONG&gt;is full empty, all data of tor_node_address must be matched by dst_ip.&lt;BR /&gt;&lt;/STRONG&gt;That means that, if no dst_ip match&amp;nbsp;tor_node_address, the search resut must be empty.&lt;BR /&gt;&lt;BR /&gt;Here a graphical view of my lookup:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_0-1687446941150.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25952i6EADE8AA4413D44E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_0-1687446941150.png" alt="SplunkExplorer_0-1687446941150.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see, the table has been created with&amp;nbsp;&lt;A title="Splunk App for Lookup File Editing" href="https://splunkbase.splunk.com/app/1724" target="_self"&gt;https://splunkbase.splunk.com/app/1724&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ensured that, after saving file, the lookup is well populated with &lt;STRONG&gt;inputlookup&lt;/STRONG&gt; command:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_1-1687447088747.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25953i33BF735E09E55DEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_1-1687447088747.png" alt="SplunkExplorer_1-1687447088747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I changed correctly lookup file permissions:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_2-1687447170289.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25954i3AEF8641B25B1EA7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_2-1687447170289.png" alt="SplunkExplorer_2-1687447170289.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_3-1687447190984.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25955iE79B3399B0A8202D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_3-1687447190984.png" alt="SplunkExplorer_3-1687447190984.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I created the related lookup definition and set correctly its permission:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_4-1687447278055.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25956i6345971F111946C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_4-1687447278055.png" alt="SplunkExplorer_4-1687447278055.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_5-1687447292699.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25957iA335FA67F5096D61/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_5-1687447292699.png" alt="SplunkExplorer_5-1687447292699.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And set no particular advanced settings, except avoid case sensitive match:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplunkExplorer_6-1687447361542.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25958i0407322AEF457987/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SplunkExplorer_6-1687447361542.png" alt="SplunkExplorer_6-1687447361542.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So, what's the problem?&lt;BR /&gt;The search dos not perform the check.&lt;BR /&gt;Even if no dst_ip match the&amp;nbsp;tor_node_address one,&lt;STRONG&gt; the search result is not empty.&lt;/STRONG&gt;&lt;BR /&gt;If I launch it, I can see the same results gained with:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=* sourcetype=cp_log direction=outbound action="Accept" 
| stats count by src_ip, dst_ip&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It seems like the lookup command is totally ignored.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 17:55:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/647954#M224226</guid>
      <dc:creator>SplunkExplorer</dc:creator>
      <dc:date>2023-06-22T17:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup command not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/647990#M224233</link>
      <description>&lt;P&gt;This is confusing. &amp;nbsp;The two screenshots revealing the content of the lookup shows exactly all null values in exclude field. &amp;nbsp;How can isnull(exclude) not output every event? &amp;nbsp;If there is a non-null value for exclude, maybe you should populate with that.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 17:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/647990#M224233</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-06-22T17:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup command not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/648006#M224235</link>
      <description>&lt;P&gt;You are right, I confuse the logic. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 19:21:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-Lookup-command-not-working/m-p/648006#M224235</guid>
      <dc:creator>SplunkExplorer</dc:creator>
      <dc:date>2023-06-22T19:21:01Z</dc:date>
    </item>
  </channel>
</rss>

