<?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 to exclude private ip address range from results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444071#M171594</link>
    <description>&lt;P&gt;Thanks alot!&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2019 06:44:46 GMT</pubDate>
    <dc:creator>damode</dc:creator>
    <dc:date>2019-05-06T06:44:46Z</dc:date>
    <item>
      <title>How to exclude private ip address range from results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444069#M171592</link>
      <description>&lt;P&gt;How to modify the below query to exclude private ip address range from source IPs (&lt;STRONG&gt;src_ip&lt;/STRONG&gt;) ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cisco eventtype=cisco-firewall host="*" action="blocked" src_ip="*" dest_ip="*" src_port="*" dest_port="*" transport="*" service="*" | top src_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2019 06:42:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444069#M171592</guid>
      <dc:creator>damode</dc:creator>
      <dc:date>2019-05-01T06:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude private ip address range from results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444070#M171593</link>
      <description>&lt;P&gt;Hi @damode,&lt;/P&gt;

&lt;P&gt;You can use CIDR block to exclude private IP ranges.&lt;/P&gt;

&lt;P&gt;For IPv4 you can try below query, if your organization is using some other IP ranges in private network then you need to add those in your search as well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cisco eventtype=cisco-firewall host="*" action="blocked" dest_ip="*" src_port="*" dest_port="*" transport="*" service="*" NOT (src_ip="10.0.0.0/8" OR src_ip="172.16.0.0/12" OR src_ip="192.168.0.0/16") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2019 08:07:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444070#M171593</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-01T08:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude private ip address range from results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444071#M171594</link>
      <description>&lt;P&gt;Thanks alot!&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 06:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/444071#M171594</guid>
      <dc:creator>damode</dc:creator>
      <dc:date>2019-05-06T06:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude private ip address range from results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/636890#M221177</link>
      <description>&lt;P&gt;Since Heff mentioned it, in order to validate private/public IPv4, I made myself an eval-based macro with the following:&lt;/P&gt;&lt;PRE&gt;case(
cidrmatch("10.0.0.0/8",$IP$),"False",
cidrmatch("172.16.0.0/12",$IP$),"False",
cidrmatch("192.168.0.0/16",$IP$),"False",
isnull($IP$) OR like($IP$,""), "False",
match($IP$,"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$"),"True")&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Then, I can use it in any query like:&lt;/P&gt;&lt;PRE&gt;| eval Remote_Address_isExternal = `isExternalIPv4(Remote_Address)`&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last line tests for a valid IPv4 address.&amp;nbsp; &lt;SPAN&gt;The best regex for validating IPV4 is an ever-evolving conversation on stack overflow.&amp;nbsp; So, I used the latest from there, but from this highest rated answer, not the accepted one:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://stackoverflow.com/a/36760050/6376311" target="_blank" rel="nofollow noopener noreferrer"&gt;https://stackoverflow.com/a/36760050/6376311&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 13:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-private-ip-address-range-from-results/m-p/636890#M221177</guid>
      <dc:creator>msquicc</dc:creator>
      <dc:date>2023-03-31T13:47:55Z</dc:date>
    </item>
  </channel>
</rss>

