<?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: Calculate the percentage of IP CIDR in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616549#M214286</link>
    <description>&lt;P&gt;Is the "clientip" the correct fieldname for the client ip? If not, either rename the field to "clientip" or modify the query to use the correct fieldname.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2022 16:22:27 GMT</pubDate>
    <dc:creator>johnhuang</dc:creator>
    <dc:date>2022-10-10T16:22:27Z</dc:date>
    <item>
      <title>How to calculate the percentage of IP CIDR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616255#M214185</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;Kindly assist me as I am not getting the results I anticipate.&lt;BR /&gt;I wish to have a table like this&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;ClientIP&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Count&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Percentage&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;1.1.1.1 - 1.1.1.255&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;50&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;50%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;2.1.1.0 - 2.1.1.255&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;25&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;25%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;3.1.1.0 - 3.1.1.255&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;25&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;25%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Total&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;100&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;Presently my query does NOT have the CIDR as I wished . It spits out individual IPs but it would be nice to have the IPs in the same CIDR range grouped in one column. That way I have a nice looking table.&lt;BR /&gt;&lt;BR /&gt;I used this query to get individual percentage but not happy with the results. I would really appreciate any help.&lt;BR /&gt;&lt;BR /&gt;index=* sourcetype=*&lt;BR /&gt;| stats count by clientip&lt;BR /&gt;| eventstats sum(count) as perc&lt;BR /&gt;| eval percentage = round(count*100/perc,2)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 14:17:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616255#M214185</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-07T14:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the percentage of IP CIDR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616258#M214188</link>
      <description>&lt;P&gt;You need to convert the client_ip to a CIDR range, then count by that range, e.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... your search ...
| rex field=clientip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"
| eval cidr_range=cidr_range.".0/24"
| stats count by cidr_range
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That will then make A.B.C.0/24 - if you want to make it A.B.C.0-A.B.C.255 then just change the eval statement&lt;/P&gt;&lt;P&gt;(Edited - to change CIDR range from 8 to 24 as per&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;comment)&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 22:44:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616258#M214188</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-10-09T22:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616260#M214189</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=* sourcetype=*
| rex field=clientip "(?&amp;lt;ip_subnet&amp;gt;\d+\.\d+\.\d+)\.\d+"
| eval ip_subnet_range=ip_subnet.".0 - ".ip_subnet.".255"
| eval ip_subnet_cidr=ip_subnet.".0/24"
| stats dc(clientip) AS ip_count BY ip_subnet_cidr ip_subnet_range
| eventstats sum(ip_count) AS total_ip_count
| eval percentage=ROUND((ip_count/total_ip_count)*100, 2)." %"
| addcoltotals labelfield=ip_subnet_cidr
| eval percentage=IF(ip_subnet_cidr="Total", "100.00 %", percentage)
| table ip_subnet_cidr ip_subnet_range ip_count percentage&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Oct 2022 03:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616260#M214189</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-07T03:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616262#M214190</link>
      <description>&lt;P&gt;A versatile alternative to rex is &amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConversionFunctions#ipmask.28.26lt.3Bmask.26gt.3B.2C.26lt.3BIP.26gt.3B.29" target="_blank" rel="noopener"&gt;ipmask&lt;/A&gt;&amp;nbsp;function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval cidr_range = ipmask("255.255.255.0", clientip)
| stats count by cidr_range
| eventstats sum(count) as total
| eval percent = 100 * count / total&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 03:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616262#M214190</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-07T03:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616408#M214229</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;, Thanks for your response. For some reasons, I couldn't get statistics values or in tabular form. I did get events and it still gave me individual IPs. I am not sure what I did wrong.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 05:18:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616408#M214229</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-08T05:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616409#M214230</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;, Thank you for responding. It still yielded individual IPs and no table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 05:22:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616409#M214230</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-08T05:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616412#M214231</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;, Thanks for your post. I got an error message in the eval command and no results.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 05:25:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616412#M214231</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-08T05:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616418#M214233</link>
      <description>&lt;P&gt;Just noticed that ipmask is only available since Splunk 9.&lt;/P&gt;&lt;P&gt;I don't understand why&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;'s solution shouldn't work. &amp;nbsp;It definitely outputs what you wanted with the following data&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;clientip&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10.12.143.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.5.250&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;172.0.58.52&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.5.13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10.12.6.8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10.12.143.82&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.5.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Using the the exact formula from&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;'s post except the correct CIDR mask of /24:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval clientip = mvappend("10.12.143.5","192.168.5.250","172.0.58.52","192.168.5.13","10.12.6.8","10.12.143.82","192.168.5.2")
| mvexpand clientip
``` ^^^ data emulation ```

| rex field=clientip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"
| eval cidr_range=cidr_range.".0/24"
| stats count by cidr_range&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the correct count.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;cidr_range&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10.12.143.0/24&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10.12.6.0/24&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;172.0.58.0/24&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.5.0/24&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=clientip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"
| eval cidr_range=cidr_range.".1 - ".cidr_range.".255"
| stats count by cidr_range​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this what you needed? &amp;nbsp;The only drawback here is that this only works with /24, /16, and /8.&lt;/P&gt;&lt;P&gt;If you really wanted to use a range notation, you can do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=clientip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"
| eval cidr_range=cidr_range.".1 - "."cidr_range.".255"
| stats count by cidr_range&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 06:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616418#M214233</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-08T06:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616441#M214243</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;, I tried the query you sent in addition to&amp;nbsp; the one from&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;. Yes, I got results. A table included.&lt;BR /&gt;1st question: since I have over 100 IPs, do I have to individually add them here like you mentioned below?&lt;/P&gt;&lt;PRE&gt;| eval clientip = mvappend("10.12.143.5","192.168.5.250","172.0.58.52","192.168.5.13","10.12.6.8","10.12.143.82","192.168.5.2")&lt;/PRE&gt;&lt;P&gt;This was my query with pseudo IPs&lt;BR /&gt;&lt;BR /&gt;| makeresults&lt;BR /&gt;index=* sourcetype=*&lt;BR /&gt;| eval clientip = mvappend("1.1.1.9","1.3.146.253","1.21.112.32","3.6.71.70")&lt;BR /&gt;| mvexpand clientip&lt;BR /&gt;| rex field=src_ip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"&lt;BR /&gt;| eval cidr_range=cidr_range.".1 - ".cidr_range.".255"&lt;BR /&gt;| stats count by cidr_range, clientip&lt;BR /&gt;| eventstats sum(count) as perc&lt;BR /&gt;| eval percentage = round(count*100/perc,2)&lt;BR /&gt;&lt;BR /&gt;I get a table that looks like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="69.44388440860216%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;cidr_range&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;clientip&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;count&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;perc&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;percentage&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1.1.1.1-&amp;nbsp;1.1.1.255&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1.1.1.9&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1.3.146.1-&amp;nbsp;1.3.146.255&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1.3.146.253&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;1.21.112.1 -&amp;nbsp;1.21.112.255&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;1.21.112.32&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;4&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;3.6.71.1 -3.6.71.255&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;3.6.71.70&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;But when I use this query&lt;BR /&gt;&lt;BR /&gt;index=* clientip="*"&lt;BR /&gt;| stats count by clientip&lt;BR /&gt;&lt;BR /&gt;to see/get all the list and count of the IPs individually I get something&amp;nbsp; roughly like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;clientip&lt;/TD&gt;&lt;TD width="50%"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;1.1.1.9&lt;/TD&gt;&lt;TD width="50%"&gt;800&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;1.3.146.253&lt;/TD&gt;&lt;TD width="50%"&gt;75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1.21.112.32&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;44&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;3.6.71.70&lt;/TD&gt;&lt;TD width="50%"&gt;52&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;In the logs, I have&amp;nbsp;1.1.1.2,&amp;nbsp;1.1.1.3,&amp;nbsp;1.1.1.4,&amp;nbsp;1.1.1.5 with their respective counts. It would be nice since they are in the same range to have them counted together in one column.&lt;BR /&gt;&lt;BR /&gt;That is I was hoping I could get the appropriate count for IPs within a cidr_range that way I can have a concise table instead of individual IPs and their count. Considering that I need to have a percentage of each cidr_range.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 20:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616441#M214243</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-08T20:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616442#M214244</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249988"&gt;@Lye&lt;/a&gt;&amp;nbsp;makeresults is just a common method to emulate data. &amp;nbsp;It is a generating command, thus cannot be combined with other generating commands such as your normal search. &amp;nbsp;Sorry for not explaining this clearly. &amp;nbsp;Just apply what&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;illustrated to your actual search, e.g.,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* clientip=*
| rex field=clientip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"
| eval cidr_range=cidr_range.".1 - ".cidr_range.".255"
| stats count by cidr_range, clientip
| eventstats sum(count) as perc
| eval percentage = round(count*100/perc,2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 22:16:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616442#M214244</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-08T22:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616549#M214286</link>
      <description>&lt;P&gt;Is the "clientip" the correct fieldname for the client ip? If not, either rename the field to "clientip" or modify the query to use the correct fieldname.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 16:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616549#M214286</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-10T16:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the percentage of IP CIDR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616577#M214298</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;, yes it's&amp;nbsp; the correct fieldname.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 21:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616577#M214298</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-10T21:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the percentage of IP CIDR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616579#M214299</link>
      <description>&lt;P&gt;I used these 2 queries below. Both gave me results (events and statistics) although a slight difference in values.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=* sourcetype=*&lt;BR /&gt;| rex field=clientip "(?&amp;lt;ip_subnet&amp;gt;\d+\.\d+\.\d+)"&lt;BR /&gt;| eval ip_subnet_range=".0 - ".ip_subnet.".255"&lt;BR /&gt;| eval ip_subnet=ip_subnet.".0/24"&lt;BR /&gt;| stats count by ip_subnet&lt;BR /&gt;| eventstats sum(count) as perc&lt;BR /&gt;| eval percentage =round(count*100/perc,2)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=* sourcetype=*&lt;BR /&gt;| rex field=clientip "(?&amp;lt;cidr_range&amp;gt;\d+\.\d+\.\d+)"&lt;BR /&gt;| eval cidr_range=cidr_range.".0 - ".cidr_range.".255"&lt;BR /&gt;| stats count by cidr_range&lt;BR /&gt;| eventstats sum(count) as perc&lt;BR /&gt;| eval percentage = round(count*100/perc,2)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you so much to&amp;nbsp;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;. I really appreciate all your help.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 22:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-percentage-of-IP-CIDR/m-p/616579#M214299</guid>
      <dc:creator>Lye</dc:creator>
      <dc:date>2022-10-10T22:09:12Z</dc:date>
    </item>
  </channel>
</rss>

