<?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 do I create a search, excluding a list of CIDR ranges? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609080#M211783</link>
    <description>&lt;P&gt;top defaults to 10 results - try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| top 0 src&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 10 Aug 2022 20:41:11 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-08-10T20:41:11Z</dc:date>
    <item>
      <title>How do I create a search, excluding a list of CIDR ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/608945#M211755</link>
      <description>&lt;P&gt;So I'm trying to create a metrics search using the following query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="test" identities="ident_*" src=10.11.40.0/22 OR src=10.11.48.0/22 OR src=10.11.56.0/22 OR src=10.11.64.0/22 OR src=10.11.72.0/22 OR src=10.120.40.0/22 OR src=10.120.48.0/22 OR src=10.120.56.0/22 OR src=10.120.64.0/22 OR src=10.15.8.0/22 OR src=10.15.40.0/22 OR src=10.15.48.0/22 OR src=10.15.56.0/22 OR src=10.15.72.0/22 OR src=10.15.76.0/22 OR  src=10.15.80.0/22 | top src | outputlookup test-excludes-no-dedup.csv&lt;/LI-CODE&gt;
&lt;P&gt;I then take the CSV and use it here:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="test" identities="ident_*" NOT [ inputlookup test-excludes-no-dedup.csv ]
| top src&lt;/LI-CODE&gt;
&lt;P&gt;Is this the correct way to [exclude] the CIDR ranges contained within the lookup CSV? I get some results doing this but here it is, almost 1AM and I'm starting to question whether OR is correct.&amp;nbsp; Maybe I should be using AND?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to find all the 'src' items that are not in those CIDR ranges in the CSV.. am I going about it correctly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 15:30:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/608945#M211755</guid>
      <dc:creator>Skeer-Jamf</dc:creator>
      <dc:date>2022-08-10T15:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Query syntax help, excluding a list of CIDR ranges..</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/608946#M211756</link>
      <description>&lt;P&gt;Firstly, if your 'src' field contains IP addresses, then you cannot use src=CIDR_RANGE in your search, unless the 'src' field itself is actually that string.&lt;/P&gt;&lt;P&gt;If your intention is to have a lookup that contains a list of CIDR ranges, then simply create the lookup, e.g. like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval src=split("10.11.40.0/22,10.11.48.0/22,10.11.56.0/22,10.11.64.0/22,10.11.72.0/22,10.120.40.0/22,10.120.48.0/22,10.120.56.0/22,10.120.64.0/22,10.15.8.0/22,10.15.40.0/22,10.15.48.0/22,10.15.56.0/22,10.15.72.0/22,10.15.76.0/22, 10.15.80.0/22", ",")
| mvexpand src
| table src
| outputlookup test-excludes.csv&lt;/LI-CODE&gt;&lt;P&gt;Then create a lookup definition and in the advanced settings, set the match type field to CIRT(src)&lt;BR /&gt;&lt;BR /&gt;Then in your code you can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search...
| lookup test-excludes src OUTPUT src as found
| where isnull(found)&lt;/LI-CODE&gt;&lt;P&gt;which will then have 'src' IP addresses that are NOT in the ranges of the lookup&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 05:03:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/608946#M211756</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-08-10T05:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Query syntax help, excluding a list of CIDR ranges..</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609000#M211770</link>
      <description>&lt;P&gt;Oh wow, I was way off! This is awesome.. I'm new to the more advanced query so definitely appreciate you. I do get a good long list of src's now. When I try to add a | top src to this to get a nice simple metric list I'm back to less than 10. So I'm pretty sure my metrics attempt is breaking things since this short list looks super similar to the one I'd get last night.&lt;/P&gt;&lt;P&gt;Maybe I should just keep it as Events..&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 12:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609000#M211770</guid>
      <dc:creator>Skeer-Jamf</dc:creator>
      <dc:date>2022-08-10T12:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Query syntax help, excluding a list of CIDR ranges..</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609042#M211777</link>
      <description>&lt;P&gt;Can I ask you something else related? If I perform everything you outlined above exactly, I get a nice healthy Events list. If I add&amp;nbsp;&lt;BR /&gt;| top src&lt;/P&gt;&lt;P&gt;I get a list of 9 src's, with their counts. I have the page row size at 50, but only get 9.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now if I add:&lt;BR /&gt;| top limit=100 src&lt;BR /&gt;&lt;BR /&gt;I get two pages worth of src's with counts. I was assuming that by not including 'limit' that the search would return all results, but that doesn't seem to be happening here.&lt;BR /&gt;&lt;BR /&gt;Any thoughts on how I can correctly return every SRC that's not in that lookup without setting a limit=?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 15:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609042#M211777</guid>
      <dc:creator>Skeer-Jamf</dc:creator>
      <dc:date>2022-08-10T15:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a search, excluding a list of CIDR ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609051#M211778</link>
      <description>&lt;P&gt;You could try using a where command post search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="test" identities="ident_*" 
| where NOT [ inputlookup test-excludes-no-dedup.csv
  | rename src as query
  | fields query
  | format "(" "cidrmatch(" "" ",src)" "AND" ")"]
| top src&lt;/LI-CODE&gt;&lt;P&gt;Not sure if the AND should be OR though&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 16:44:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609051#M211778</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-08-10T16:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a search, excluding a list of CIDR ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609066#M211781</link>
      <description>&lt;P&gt;Hmm, same result. Well now it's 10 src's with a 50 per page setting. Trying like earlier, adding top limit=100 src returns 100.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for w/e reason it's still not wanting to dump all the results w/o limit.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 18:22:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609066#M211781</guid>
      <dc:creator>Skeer-Jamf</dc:creator>
      <dc:date>2022-08-10T18:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a search, excluding a list of CIDR ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609080#M211783</link>
      <description>&lt;P&gt;top defaults to 10 results - try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| top 0 src&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Aug 2022 20:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-search-excluding-a-list-of-CIDR-ranges/m-p/609080#M211783</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-08-10T20:41:11Z</dc:date>
    </item>
  </channel>
</rss>

