<?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 calculate percent of size in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338801#M170309</link>
    <description>&lt;P&gt;@fzfengzhuang this seems to be a duplicate question of &lt;A href="https://answers.splunk.com/answers/641469/how-to-do-a-pie-chart.html"&gt;https://answers.splunk.com/answers/641469/how-to-do-a-pie-chart.html&lt;/A&gt;&lt;BR /&gt;
 Could you please confirm?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 17:22:36 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-04-17T17:22:36Z</dc:date>
    <item>
      <title>how to calculate percent of size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338798#M170306</link>
      <description>&lt;P&gt;hello  &lt;/P&gt;

&lt;P&gt;thanks for all your help&lt;/P&gt;

&lt;P&gt;how can I calculate the percent of size base on the data&lt;BR /&gt;
size＜1024   2048＜size ＞1024  size ＞2048&lt;/P&gt;

&lt;P&gt;index=maillog size=*&lt;BR /&gt;
 | stats count(eval(size&amp;lt;1024)) as "&amp;lt;1024" count(eval(size&amp;gt;1024 AND size&amp;lt;2048)) as "1024&amp;gt; &amp;amp; &amp;lt;2028"  count(eval(size&amp;gt;2048)) as "&amp;gt;2048"&lt;BR /&gt;
 | transpose column_name="size_range"&lt;BR /&gt;
 | rename "row 1" as count&lt;/P&gt;

&lt;P&gt;thanks again&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:02:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338798#M170306</guid>
      <dc:creator>fzfengzhuang</dc:creator>
      <dc:date>2020-09-29T19:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percent of size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338799#M170307</link>
      <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;please try this search anywhere:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | makeresults count=1
    | eval size="1025,1000,2000,3000,500,5000,200,4000,2100,3001,800,100,2048"
    | makemv delim="," size
    | mvexpand size
    | stats count as event_count count(eval(size&amp;lt;1024)) as less_than count(eval(size&amp;gt;1024 AND size&amp;lt;2048)) as in_between count(eval(size&amp;gt;2048)) as greater_than
    | eval percent_less = round(less_than/event_count*100, 2), percent_in_between = round(in_between/event_count*100, 2), percent_greater_than = round(greater_than/event_count*100, 2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;see screenshot below:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4772i0D3509AEFBB412DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;note, see how it does not count the value "2048" as it is equal (not greater or lesser than) so you can add that rule as you see fit&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:34:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338799#M170307</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-04-17T14:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percent of size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338800#M170308</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;Try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=maillog size=*
| stats count(eval(size&amp;lt;1024)) as "val1" count(eval(size&amp;gt;=1024 AND size&amp;lt;2048)) as "val2" count(eval(size&amp;gt;=2048)) as val3 count as tot
| eval perc1=round(100*val1/tot), perc2=round(100*val2/tot), perc3=round(100*val3/tot)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;| transpose column_name="size_range" | rename "row 1" as count&lt;/P&gt;

&lt;P&gt;Or This: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=maillog size=*
    | stats count(eval(size&amp;lt;1024)) as "val1" count(eval(size&amp;gt;=1024 AND size&amp;lt;2048)) as "val2" count(eval(size&amp;gt;=2048)) as val3 
    | transpose column_name="size_range"
    | rename "row 1" as row1
    | eventstats sum(row1) as total
    | eval row1=round(100*row1/total)
    | transpose column_name="size_range" | rename "row 1" as count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:03:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338800#M170308</guid>
      <dc:creator>TISKAR</dc:creator>
      <dc:date>2020-09-29T19:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percent of size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338801#M170309</link>
      <description>&lt;P&gt;@fzfengzhuang this seems to be a duplicate question of &lt;A href="https://answers.splunk.com/answers/641469/how-to-do-a-pie-chart.html"&gt;https://answers.splunk.com/answers/641469/how-to-do-a-pie-chart.html&lt;/A&gt;&lt;BR /&gt;
 Could you please confirm?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 17:22:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percent-of-size/m-p/338801#M170309</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-17T17:22:36Z</dc:date>
    </item>
  </channel>
</rss>

