<?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 Splunk lookup file - lookup field question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699198#M237383</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I've got a lookup file called &lt;EM&gt;devices.csv&lt;/EM&gt; that contains 2 fields, &lt;EM&gt;hostname&lt;/EM&gt; and &lt;EM&gt;ip_address&lt;/EM&gt;.&lt;BR /&gt;&lt;BR /&gt;The index I'm searching has 2 fields, &lt;EM&gt;src_ip&lt;/EM&gt; and &lt;EM&gt;dest_ip.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;I'd like to exclude results where both the &lt;EM&gt;src_ip&lt;/EM&gt; &lt;STRONG&gt;and&lt;/STRONG&gt; &lt;EM&gt;dest_ip&lt;/EM&gt; fields match an IP address from my lookup file, it doesn't need to be the same IP, it just needs to be listed in that CSV. If either the &lt;EM&gt;src_ip&lt;/EM&gt; field or the &lt;EM&gt;dest_ip&lt;/EM&gt; field doesn't contain an IP address listed in the ip_address field I would expect to see it.&lt;/P&gt;
&lt;P&gt;I'm just looking for advice on whether this is the best way of querying the data. Current query:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=network_traffic AND NOT ([| inputlookup devices.csv | fields ip_address | rename ip_address AS src_ip] AND [| inputlookup devices.csv | fields ip_address | rename ip_address AS dest_ip])&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 16 Sep 2024 19:53:50 GMT</pubDate>
    <dc:creator>Pellecrino</dc:creator>
    <dc:date>2024-09-16T19:53:50Z</dc:date>
    <item>
      <title>Splunk lookup file - lookup field question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699198#M237383</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I've got a lookup file called &lt;EM&gt;devices.csv&lt;/EM&gt; that contains 2 fields, &lt;EM&gt;hostname&lt;/EM&gt; and &lt;EM&gt;ip_address&lt;/EM&gt;.&lt;BR /&gt;&lt;BR /&gt;The index I'm searching has 2 fields, &lt;EM&gt;src_ip&lt;/EM&gt; and &lt;EM&gt;dest_ip.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;I'd like to exclude results where both the &lt;EM&gt;src_ip&lt;/EM&gt; &lt;STRONG&gt;and&lt;/STRONG&gt; &lt;EM&gt;dest_ip&lt;/EM&gt; fields match an IP address from my lookup file, it doesn't need to be the same IP, it just needs to be listed in that CSV. If either the &lt;EM&gt;src_ip&lt;/EM&gt; field or the &lt;EM&gt;dest_ip&lt;/EM&gt; field doesn't contain an IP address listed in the ip_address field I would expect to see it.&lt;/P&gt;
&lt;P&gt;I'm just looking for advice on whether this is the best way of querying the data. Current query:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=network_traffic AND NOT ([| inputlookup devices.csv | fields ip_address | rename ip_address AS src_ip] AND [| inputlookup devices.csv | fields ip_address | rename ip_address AS dest_ip])&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Sep 2024 19:53:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699198#M237383</guid>
      <dc:creator>Pellecrino</dc:creator>
      <dc:date>2024-09-16T19:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk lookup file - lookup field question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699202#M237384</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/272243"&gt;@Pellecrino&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;your search seems to be correct, I'd change the order of the commands, even if it should not be relevant:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=network_traffic NOT ( [ | inputlookup devices.csv | rename ip_address AS src_ip | fields src_ip ] [ | inputlookup devices.csv | rename ip_address AS dest_ip | fields dest_ip ] )&lt;/LI-CODE&gt;&lt;P&gt;Debug the issue running one by one the two conditions.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 16:04:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699202#M237384</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-09-16T16:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk lookup file - lookup field question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699206#M237387</link>
      <description>&lt;P&gt;While the search is technically more or lese correct, its performance will depend on the use case and with a big lookup you might hit search limits.&lt;/P&gt;&lt;P&gt;Another possible approach would be&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_base_search&amp;gt;&lt;BR /&gt;| lookup my.csv src_ip OUTPUT matchsrc_ip&lt;BR /&gt;| lookup my.csv dest_ip OUTPUT matchdest_ip&lt;BR /&gt;| where isnull(matchsrc_ip) AND isnull(matchdest_ip)&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Sep 2024 18:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699206#M237387</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-16T18:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk lookup file - lookup field question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699239#M237391</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;that using lookup might be more performant if the lookup file is not very large and there are not many matches. &amp;nbsp;If the lookup is very large, you can eliminate one subsearch because there is only one lookup.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=network_traffic NOT 
    [inputlookup devices.csv
    | stats values(ip_address) AS src_ip
    | eval dest_ip = src_ip]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 03:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-lookup-file-lookup-field-question/m-p/699239#M237391</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-17T03:22:07Z</dc:date>
    </item>
  </channel>
</rss>

