<?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: Percentage calculation by timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/538609#M152287</link>
    <description>&lt;P&gt;Can you explain this query...the logic etc&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 13:43:08 GMT</pubDate>
    <dc:creator>beriwalnishant</dc:creator>
    <dc:date>2021-02-04T13:43:08Z</dc:date>
    <item>
      <title>Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246841#M73576</link>
      <description>&lt;P&gt;We have a request to get values from particular field based on % of bin count.&lt;/P&gt;

&lt;P&gt;(1) &lt;CODE&gt;index=ABC | timechart span=1d count by&lt;/CODE&gt;  =&amp;gt; By this we get count of the bins for the particular days  spanned by day&lt;/P&gt;

&lt;P&gt;(2) &lt;CODE&gt;index=ABC| top limit=0&lt;/CODE&gt;  =&amp;gt; By this we get the bin % of the field value but it is not spanned but for the number of days we select in time picker.&lt;/P&gt;

&lt;P&gt;So I am looking for a search which will: &lt;BR /&gt;
i. calculate the bin count of the values in  i.e error no 400, 200, 201, 208 separately also these should be spanned based on timechart we specify and i.e if I want bin count per day basis for the month it should show that.&lt;/P&gt;

&lt;P&gt;Thanks for the help in query in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 06:39:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246841#M73576</guid>
      <dc:creator>vikram_m</dc:creator>
      <dc:date>2017-01-19T06:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246842#M73577</link>
      <description>&lt;P&gt;Does this help ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your index|timechart span=10m count by error_no|addtotals row=true fieldname=_Total|foreach * [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' * 100 / _Total] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2017 07:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246842#M73577</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2017-01-19T07:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246843#M73578</link>
      <description>&lt;P&gt;Hello Renjith, the query when I used is not giving me % value instead it is giving me the same bin count as it provides with time chart.&lt;/P&gt;

&lt;P&gt;can you please tell me what do I need to put for  and  is the same field name which we want count for ?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 08:20:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246843#M73578</guid>
      <dc:creator>vikram_m</dc:creator>
      <dc:date>2017-01-19T08:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246844#M73579</link>
      <description>&lt;P&gt;you just execute the same query as a whole. Just change the indexname and if needed error_no to our error number. Don't change &lt;CODE&gt;FIELD&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 08:28:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246844#M73579</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2017-01-19T08:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246845#M73580</link>
      <description>&lt;P&gt;this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ABC|bucket _time span=1d| stats count by errorNo _time|eventstats sum(count) as total by errorNo |eval percentage=(count/total)*100|chart values(percentage) by _time errorNo 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;however the answer that @renjith.nair seems logical as well, &lt;CODE&gt;foreach&lt;/CODE&gt; statements work wonders.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 12:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246845#M73580</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-01-19T12:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246846#M73581</link>
      <description>&lt;P&gt;Thanks cmerriman , renjith.nair  for your replies. One of my collegue also found exactly what client was looking for the querry looks as pasted below. But however the querries you guys mentioned above also I'll try that so we have some more querries ready incase if client comes with some thing new. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;Index_Name&amp;gt; CustomField=&amp;lt;Custom_Field1&amp;gt; CustomField=&amp;lt;Custom_Field2&amp;gt;| bucket _time span=1d | stats count by _time,&amp;lt;Custom_Field2&amp;gt; | eventstats sum(count) as total by _time | eval percent=((count/total)*100)| table _time, &amp;lt;Custom_Field2&amp;gt;, count, total, percent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Jan 2017 06:34:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246846#M73581</guid>
      <dc:creator>vikram_m</dc:creator>
      <dc:date>2017-01-23T06:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246847#M73582</link>
      <description>&lt;P&gt;Helped for me - nice solution. Should be accepted answer &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/246847#M73582</guid>
      <dc:creator>goelli</dc:creator>
      <dc:date>2018-06-26T11:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation by timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/538609#M152287</link>
      <description>&lt;P&gt;Can you explain this query...the logic etc&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 13:43:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-calculation-by-timechart/m-p/538609#M152287</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2021-02-04T13:43:08Z</dc:date>
    </item>
  </channel>
</rss>

