<?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: Exclude Source IP and Destination IP from results if they belong to same private ip range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557608#M158362</link>
    <description>&lt;P&gt;Well i tried this and it worked for me, thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.....| eval str=if(cidrmatch(10.0.0.0/8,src),1,0)| eval dtr=if(cidrmatch(10.0.0.0/8,dest),1,0)| stats count by src dest str dtr|where str!=dtr&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 29 Jun 2021 13:54:01 GMT</pubDate>
    <dc:creator>sarwshai</dc:creator>
    <dc:date>2021-06-29T13:54:01Z</dc:date>
    <item>
      <title>Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557597#M158357</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;How do i&amp;nbsp;Exclude Source IP and Destination IP from results if they belong to same private ip range? For e.g. in the results as shown below&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;src_ip&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;dest_ip&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;10.0.0.1&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;10.10.0.1&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="24px"&gt;10.0.0.1&lt;/TD&gt;&lt;TD height="24px"&gt;192.168.0.1&lt;/TD&gt;&lt;TD height="24px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to exclude the first row in the statistics as they belong to same&amp;nbsp;private ip range but want to keep the second row.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557597#M158357</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2021-06-29T13:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557602#M158358</link>
      <description>&lt;P&gt;Try something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where NOT cidrmatch("10.0.0.0/8", src_ip) OR NOT cidrmatch("10.0.0.0/8", dest_ip)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:20:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557602#M158358</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-29T13:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557605#M158359</link>
      <description>&lt;P&gt;No it doesn't work by this.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557605#M158359</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2021-06-29T13:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557606#M158360</link>
      <description>&lt;P&gt;In what way?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557606#M158360</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-29T13:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557607#M158361</link>
      <description>&lt;P&gt;I am still getting the same private ip range in the same rows&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557607#M158361</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2021-06-29T13:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557608#M158362</link>
      <description>&lt;P&gt;Well i tried this and it worked for me, thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.....| eval str=if(cidrmatch(10.0.0.0/8,src),1,0)| eval dtr=if(cidrmatch(10.0.0.0/8,dest),1,0)| stats count by src dest str dtr|where str!=dtr&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557608#M158362</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2021-06-29T13:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Source IP and Destination IP from results if they belong to same private ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557619#M158365</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/58337"&gt;@sarwshai&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;P&gt;Here I have considered below IP ranges as private IP ranges.&lt;/P&gt;&lt;P&gt;Private IP addresses:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;10.0.0.0 to 10.255.255.255&lt;/LI&gt;&lt;LI&gt;172.16.0.0 to 172.31.255.255&lt;/LI&gt;&lt;LI&gt;192.168.0.0 to 192.168.255.255&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| rex field=src_ip "(?&amp;lt;src_range_1&amp;gt;[0-9]{1,3}).(?&amp;lt;src_range_2&amp;gt;[0-9]{1,3}).[0-9]{1,3}."
| rex field=dest_ip "(?&amp;lt;dest_range_1&amp;gt;[0-9]{1,3}).(?&amp;lt;dest_range_2&amp;gt;[0-9]{1,3}).[0-9]{1,3}."
| table src_ip	dest_ip	count src_range* dest_range_1 dest_range_2
| eval is_valid_ip = case(
src_range_1="10" and src_range_1=dest_range_1,"0",
src_range_1="192" and src_range_1=dest_range_1,"0",
src_range_1="172" and src_range_1=dest_range_1 and src_range_2&amp;gt;15 and dest_range_2&amp;lt;32,"0",
1==1,"1")
| where is_valid_ip="1"
| table src_ip	dest_ip	count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="src_ip	dest_ip	count
10.0.0.1	10.10.0.1	1
10.0.0.1	192.168.0.1	1
10.0.0.1	10.10.0.1	1
10.0.0.1	10.10.0.1	1
172.16.0.0	172.31.255.255	1
192.168.0.0	192.168.255.255	1
10.0.0.1	10.10.0.1	1
" | multikv forceheader=1
| rex field=src_ip "(?&amp;lt;src_range_1&amp;gt;[0-9]{1,3}).(?&amp;lt;src_range_2&amp;gt;[0-9]{1,3}).[0-9]{1,3}."
| rex field=dest_ip "(?&amp;lt;dest_range_1&amp;gt;[0-9]{1,3}).(?&amp;lt;dest_range_2&amp;gt;[0-9]{1,3}).[0-9]{1,3}."
| table src_ip	dest_ip	count src_range* dest_range_1 dest_range_2
| eval is_valid_ip = case(
src_range_1="10" and src_range_1=dest_range_1,"0",
src_range_1="192" and src_range_1=dest_range_1,"0",
src_range_1="172" and src_range_1=dest_range_1 and src_range_2&amp;gt;15 and dest_range_2&amp;lt;32,"0",
1==1,"1")
| where is_valid_ip="1"
| table src_ip	dest_ip	count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 14:29:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-Source-IP-and-Destination-IP-from-results-if-they-belong/m-p/557619#M158365</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-06-29T14:29:03Z</dc:date>
    </item>
  </channel>
</rss>

