<?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: Problems with rounding in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18331#M2654</link>
    <description>&lt;P&gt;The solution above it not working.. &lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2011 08:52:53 GMT</pubDate>
    <dc:creator>assaftoval</dc:creator>
    <dc:date>2011-05-24T08:52:53Z</dc:date>
    <item>
      <title>Problems with rounding</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18329#M2652</link>
      <description>&lt;P&gt;Having difficulty with simple rounding. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal  group=per_sourcetype_thruput | eval gb=round(kb/1048576, 2)| stats sum(gb) sum(kb) by series |sort -sum(gb) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Incorrect GB in result:&lt;BR /&gt;
series&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum(gb)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     sum(kb)&lt;BR /&gt;
wineventlog:security    1.66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  4727905.487416&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal  group=per_sourcetype_thruput | eval gb=kb/1048576| stats sum(gb) sum(kb) by series |sort -sum(gb) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Correct GB in result without rounding:&lt;BR /&gt;
series&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum(gb)   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum(kb)&lt;BR /&gt;
wineventlog:security    4.5088820335775 &amp;nbsp;&amp;nbsp;4727905.487416&lt;/P&gt;

&lt;P&gt;Have tried various versions of the base formula:&lt;BR /&gt;
gb=round(kb/104856)&lt;BR /&gt;
gb=round((kb/1024/1024), 2)&lt;BR /&gt;
gb=round(((kb/1024)/1024), 2)&lt;BR /&gt;
gb=round(kb/1024/1024) &lt;/P&gt;

&lt;P&gt;But nothing works. What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2010 06:29:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18329#M2652</guid>
      <dc:creator>rgcox1</dc:creator>
      <dc:date>2010-07-22T06:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with rounding</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18330#M2653</link>
      <description>&lt;P&gt;If you round before summing up the values, you round off most of it before you can actually add it up. Most of the &lt;CODE&gt;kb&lt;/CODE&gt; values are small. If you divide any number less than 10,000 by 1,000,000 (or 1,048,576) and round to 2 places, it comes out to zero, so you end up adding up a whole bunch of zeros.&lt;/P&gt;

&lt;P&gt;The solution is to round &lt;EM&gt;after&lt;/EM&gt; you sum, e.g.:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal group=per_sourcetype_thruput
| stats sum(kb) as sum_kb by series
| eval sum_gb=round(sum_kb/1048576,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jul 2010 06:46:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18330#M2653</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-07-22T06:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with rounding</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18331#M2654</link>
      <description>&lt;P&gt;The solution above it not working.. &lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2011 08:52:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18331#M2654</guid>
      <dc:creator>assaftoval</dc:creator>
      <dc:date>2011-05-24T08:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with rounding</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18332#M2655</link>
      <description>&lt;P&gt;I downvoted this post because solution is not working&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 02:17:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18332#M2655</guid>
      <dc:creator>rishiaggarwal</dc:creator>
      <dc:date>2016-10-19T02:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with rounding</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18333#M2656</link>
      <description>&lt;P&gt;I think you need to sum the data in KB by Host rather than series. Each host has multiple sources and source types. It would be better to monitor the data throughput per host then series. Use the below search query:&lt;/P&gt;

&lt;P&gt;index=_internal group=per_sourcetype_thruput | stats sum(kb) as DataKB, avg(kbps) as AVG-KBPS by host | eval DataGB=round(DataKB/1048576,2) | sort DataGB&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:27:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18333#M2656</guid>
      <dc:creator>ashishganger</dc:creator>
      <dc:date>2020-09-29T11:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with rounding</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18334#M2657</link>
      <description>&lt;P&gt;Also mind that there should be no space while using the round function  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 08:21:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-rounding/m-p/18334#M2657</guid>
      <dc:creator>ashishganger</dc:creator>
      <dc:date>2016-10-19T08:21:05Z</dc:date>
    </item>
  </channel>
</rss>

