<?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: Filter IPs not in ranges in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658477#M227449</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;SPAN&gt;and I want to identify IPs that do not belong to any of the IP address ranges in my results. Example :&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/260810"&gt;@karimoss&lt;/a&gt;&amp;nbsp;- Do you want to print out all the possible IP addresses that are not in your result?&lt;/P&gt;&lt;P&gt;* How is&amp;nbsp;d.e.f.g IP different from other IPs in the result set? Is it the only IP with a different subnet?&lt;/P&gt;&lt;P&gt;* Are you looking to find subnet vise?&lt;/P&gt;</description>
    <pubDate>Sat, 23 Sep 2023 13:15:46 GMT</pubDate>
    <dc:creator>VatsalJagani</dc:creator>
    <dc:date>2023-09-23T13:15:46Z</dc:date>
    <item>
      <title>Filter IPs not in ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658476#M227448</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a list of IPs generated from the following search :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=&amp;lt;source&amp;gt;| stats count by ip&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and I want to identify IPs that do not belong to any of the IP address ranges in my results. Example :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a.b.c.101&lt;/P&gt;&lt;P&gt;a.b.c.102&lt;/P&gt;&lt;P&gt;a.b.c.103&lt;/P&gt;&lt;P&gt;d.e.f.g&lt;/P&gt;&lt;P&gt;a.b.c.104&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to keep only the address d.e.f.g&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank in advance for your help&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 12:22:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658476#M227448</guid>
      <dc:creator>karimoss</dc:creator>
      <dc:date>2023-09-23T12:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter IPs not in ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658477#M227449</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;SPAN&gt;and I want to identify IPs that do not belong to any of the IP address ranges in my results. Example :&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/260810"&gt;@karimoss&lt;/a&gt;&amp;nbsp;- Do you want to print out all the possible IP addresses that are not in your result?&lt;/P&gt;&lt;P&gt;* How is&amp;nbsp;d.e.f.g IP different from other IPs in the result set? Is it the only IP with a different subnet?&lt;/P&gt;&lt;P&gt;* Are you looking to find subnet vise?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 13:15:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658477#M227449</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2023-09-23T13:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Filter IPs not in ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658485#M227454</link>
      <description>&lt;P&gt;Also remember that by filtering early you make search more efficient.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 18:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658485#M227454</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-09-23T18:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Filter IPs not in ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658487#M227456</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/93915"&gt;@VatsalJagani&lt;/a&gt;&amp;nbsp;said, you need to talk to someone who understands IPv4 address space to help you formulating what you call "IP address ranges" into mathematical formula(e) that a computer can easily understand. &amp;nbsp;Maybe a network engineer in your organization. (You don't want to give your internal IP ranges to a public forum like this.) &amp;nbsp;These days, CIDR is the most common way of expressing IPv4 address ranges, and Splunk supports it right in the search command. &amp;nbsp;See&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Search#CIDR_matching" target="_blank" rel="noopener"&gt;CIDR matching&lt;/A&gt;. &amp;nbsp;Once you know your CIDR, you can do something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = &amp;lt;source&amp;gt; ip != &amp;lt;CIDR1&amp;gt; ip != &amp;lt;CIDR2&amp;gt;, ...
| stats count by ip&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To give you an example using the same data as given in the document, you want to exclude 10.10.10.1 through 10.10.10.255, and your data contains these&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_time&lt;/TD&gt;&lt;TD&gt;ip&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2023-09-23 16:08:12&lt;/TD&gt;&lt;TD&gt;10.10.10.12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2023-09-23 16:08:12&lt;/TD&gt;&lt;TD&gt;50.10.10.17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2023-09-23 16:08:12&lt;/TD&gt;&lt;TD&gt;10.10.10.23&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;You run&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = &amp;lt;source&amp;gt; ip != 10.10.10.0/24
| stats count by ip&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ip&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;50.10.10.17&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;You can try this with the following emulation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval ip = split("10.10.10.12
50.10.10.17
10.10.10.23", "
")
| mvexpand ip
``` the above emulates raw data ```
| search ip!=10.10.10.0/24
| stats count by ip&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can't find suitable people to ask for help, there are also CIDR calculators online. &amp;nbsp;Just be careful with your proprietary data.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 23:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-IPs-not-in-ranges/m-p/658487#M227456</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-23T23:16:43Z</dc:date>
    </item>
  </channel>
</rss>

