<?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 a percentage on chart count over some span in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164602#M46746</link>
    <description>&lt;P&gt;Don't forget to "Accept" my answer.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jun 2015 15:09:35 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-06-16T15:09:35Z</dc:date>
    <item>
      <title>Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164595#M46739</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;I have response time data in ms in a table field ElTime. I want to band this based on 1000ms second brackets then show the counts in each band and also show the percentage. For some reason I cannot seem to get the percentage working. I have been through several solutions on here, but so far haven't found one covering my scenario. My gut is that this should be an easy one but I can't get it working.&lt;/P&gt;

&lt;P&gt;My basic query is ~&lt;/P&gt;

&lt;P&gt;| chart count over ElTime span=1000 |sort -ElTime&lt;/P&gt;

&lt;P&gt;I've tried a few things nothing which I can get to work e.g.&lt;/P&gt;

&lt;P&gt;| eventstats count as total | chart count over EntsBWElapTime span=1000,eval Percent=(count/total)*100&lt;/P&gt;

&lt;P&gt;Sry total newbie struggling to make this work!&lt;/P&gt;

&lt;P&gt;The results I would hope to get would be like ~&lt;/P&gt;

&lt;P&gt;Elapsed Time (ms)   Count  Percentage&lt;BR /&gt;
0   1602364 99.82%&lt;BR /&gt;
1000    1938    0.12%&lt;BR /&gt;
2000    199 0.01%&lt;/P&gt;

&lt;P&gt;Any pointers are much appreciated, I would also be interested in a solution that would allow defined bands rather than just steps e.g. 0-250ms,251-500 etc etc.&lt;/P&gt;

&lt;P&gt;N&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 11:28:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164595#M46739</guid>
      <dc:creator>nmulm</dc:creator>
      <dc:date>2015-06-16T11:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164596#M46740</link>
      <description>&lt;P&gt;Hi nmulm &lt;BR /&gt;
Try this search code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;enter something here | eventstats count as total | chart span=1000 count over EntsBWElapTime |eval Percent=(count/total)*100|table EntsBWElapTime  count Percent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jun 2015 13:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164596#M46740</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-06-16T13:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164597#M46741</link>
      <description>&lt;P&gt;Thanks for that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I think there may be an issue with the &lt;EM&gt;total&lt;/EM&gt; value as the Percentage column just ends up blank, and if I include total in the table it is also blank. I am getting the counts banded correctly just not the percentages. &lt;/P&gt;

&lt;P&gt;That was the thing that I was struggling with i.e. does eventstats calculate the total of the entire result set before the chart breaks out the EntsBWElapTIme into the relevent bands?&lt;/P&gt;

&lt;P&gt;N&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 13:29:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164597#M46741</guid>
      <dc:creator>nmulm</dc:creator>
      <dc:date>2015-06-16T13:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164598#M46742</link>
      <description>&lt;P&gt;In this case , i advise you to use stats command &lt;STRONG&gt;instead&lt;/STRONG&gt; of &lt;STRONG&gt;eventstats&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; enter something here | stats count as total | chart span=1000 count over EntsBWElapTime |eval Percent=(count/total)*100|table EntsBWElapTime  count Percent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jun 2015 13:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164598#M46742</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-06-16T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164599#M46743</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval ElapsedTime = case (EITime&amp;lt;=250, "0-250", EITime&amp;lt;=500, "251-500", EITime&amp;lt;=750, "501-750", EITime&amp;lt;=1000, "751-1000", 1==1, "1000+") | top limit=0 ElapsedTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jun 2015 13:43:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164599#M46743</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-16T13:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164600#M46744</link>
      <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eventstats count as total| bucket _time span=1000ms | stats count by "EntsBWElapTime" |eval Percent=(count/total)*100 +"%"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eventstats count as total | timechart span=1000ms count by EntsBWElapTime |eval Percent=(count/total)*100 +"%" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jun 2015 13:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164600#M46744</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2015-06-16T13:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164601#M46745</link>
      <description>&lt;P&gt;Excellent thanks this worked for me, for some reason the using eventstats \ stats count as total methods listed would not do it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 14:03:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164601#M46745</guid>
      <dc:creator>nmulm</dc:creator>
      <dc:date>2015-06-16T14:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a percentage on chart count over some span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164602#M46746</link>
      <description>&lt;P&gt;Don't forget to "Accept" my answer.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 15:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-a-percentage-on-chart-count-over-some-span/m-p/164602#M46746</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-16T15:09:35Z</dc:date>
    </item>
  </channel>
</rss>

