<?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: problem with rounding bytes to gb in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465311#M140532</link>
    <description>&lt;P&gt;Your &lt;EM&gt;expected&lt;/EM&gt; result is not the &lt;EM&gt;correct&lt;/EM&gt; result.  0.00000872090458869934 properly rounds to 0.000.  To get a non-zero result, consider converting to MB rather than GB.  Or try &lt;CODE&gt;| eval b = max(0.001, b)&lt;/CODE&gt;.&lt;BR /&gt;
It's not necessary to use &lt;CODE&gt;foreach&lt;/CODE&gt; to round the results.  &lt;CODE&gt;| eval b = round(b/1024/1024/1024, 3)&lt;/CODE&gt; would work&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2020 14:33:31 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-04-01T14:33:31Z</dc:date>
    <item>
      <title>problem with rounding bytes to gb</title>
      <link>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465310#M140531</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;I have use this command to convert from bytes to GB:&lt;BR /&gt;| eval b = b /1024/1024/1024&lt;BR /&gt;and this is an example value as result:&lt;BR /&gt;index1: 0.00000872090458869934&lt;BR /&gt;but the value is to long so I tried to round using this instead:&lt;BR /&gt;| foreach * [ eval &amp;lt;&amp;gt;=round('&amp;lt;&amp;gt;'/1024/1024/1024, 3)] &lt;BR /&gt;but then I get this result:&lt;BR /&gt;index1: 0.000 &lt;BR /&gt;and I expect to get index1: 0.001&lt;/P&gt;
&lt;P&gt;Can you suggest how to do that correctly so I get the expected result?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 22:01:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465310#M140531</guid>
      <dc:creator>net1993</dc:creator>
      <dc:date>2020-06-08T22:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: problem with rounding bytes to gb</title>
      <link>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465311#M140532</link>
      <description>&lt;P&gt;Your &lt;EM&gt;expected&lt;/EM&gt; result is not the &lt;EM&gt;correct&lt;/EM&gt; result.  0.00000872090458869934 properly rounds to 0.000.  To get a non-zero result, consider converting to MB rather than GB.  Or try &lt;CODE&gt;| eval b = max(0.001, b)&lt;/CODE&gt;.&lt;BR /&gt;
It's not necessary to use &lt;CODE&gt;foreach&lt;/CODE&gt; to round the results.  &lt;CODE&gt;| eval b = round(b/1024/1024/1024, 3)&lt;/CODE&gt; would work&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 14:33:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465311#M140532</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-01T14:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: problem with rounding bytes to gb</title>
      <link>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465312#M140533</link>
      <description>&lt;P&gt;Thanks. But I have fields for every date so I have 31 fields thats why I use foreach.&lt;BR /&gt;
About to use MB, what if for some values its more appropriate GB (big number)?&lt;BR /&gt;
 max(0.001, b) if I understand correctly this will do to show the bigger number from the two arguments? If yes then will kind work but thats kind of not what I want&lt;BR /&gt;
I want to make round function work always but to round to upper border instead of both  &amp;lt;5 || &amp;gt;5&lt;BR /&gt;
I am sure I have seen this in C# but isn't there something similar in splunk?&lt;BR /&gt;
Tried with ceiling() but this rounds to whole number  so not what I need.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 14:46:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465312#M140533</guid>
      <dc:creator>net1993</dc:creator>
      <dc:date>2020-04-01T14:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: problem with rounding bytes to gb</title>
      <link>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465313#M140534</link>
      <description>&lt;P&gt;If you convert to MB and the number is big then convert it again to GB.  You'll likely want to include units so users know if the display is MB or GB.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval B = if(b &amp;lt; 1*1024*1024, b/1024/1024 . " MB", b/1024/1024/1024 . " GB")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Apr 2020 15:06:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465313#M140534</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-01T15:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: problem with rounding bytes to gb</title>
      <link>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465314#M140535</link>
      <description>&lt;P&gt;I decided to use your first suggestion | eval b = max(0.001, b)&lt;BR /&gt;
Thank you very much for fast response and smart idea for this.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 15:21:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/problem-with-rounding-bytes-to-gb/m-p/465314#M140535</guid>
      <dc:creator>net1993</dc:creator>
      <dc:date>2020-04-01T15:21:46Z</dc:date>
    </item>
  </channel>
</rss>

