<?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 round fuction usage for avg command output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63344#M180276</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;I have been using the &lt;STRONG&gt;stats avg(duration) as Avg_Duration&lt;/STRONG&gt; in my query.But while displayin the Avg_Duration i am getting the output value with 6 decimal digits after the precision.Something like 2.123456 i would like to round it off to four digits only.Tried using the round function along with the stats command..but it didnt worked.&lt;/P&gt;

&lt;P&gt;Please help me on this .Thanx&lt;/P&gt;</description>
    <pubDate>Wed, 30 May 2012 08:11:33 GMT</pubDate>
    <dc:creator>rakesh_498115</dc:creator>
    <dc:date>2012-05-30T08:11:33Z</dc:date>
    <item>
      <title>round fuction usage for avg command output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63344#M180276</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;I have been using the &lt;STRONG&gt;stats avg(duration) as Avg_Duration&lt;/STRONG&gt; in my query.But while displayin the Avg_Duration i am getting the output value with 6 decimal digits after the precision.Something like 2.123456 i would like to round it off to four digits only.Tried using the round function along with the stats command..but it didnt worked.&lt;/P&gt;

&lt;P&gt;Please help me on this .Thanx&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2012 08:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63344#M180276</guid>
      <dc:creator>rakesh_498115</dc:creator>
      <dc:date>2012-05-30T08:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: round fuction usage for avg command output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63345#M180277</link>
      <description>&lt;P&gt;What have you tried already when you tried to round?&lt;BR /&gt;
Something like this works with my setup;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats avg(duration) as Avg_duration | eval Avg_duration=round(Avg_duration,0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 May 2012 10:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63345#M180277</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2012-05-30T10:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: round fuction usage for avg command output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63346#M180278</link>
      <description>&lt;P&gt;It would be a lot better inline. I tried but as such in our 6.1.2 server cannot it does not work. ie. &lt;PRE&gt; | stats round(avg(duration),0) &lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2014 00:28:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63346#M180278</guid>
      <dc:creator>emikulic</dc:creator>
      <dc:date>2014-09-12T00:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: round fuction usage for avg command output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63347#M180279</link>
      <description>&lt;P&gt;I know this has been around a while, but I felt I should share this with the community. You can incorporate the eval statement into the stats command:&lt;BR /&gt;
EG:&lt;BR /&gt;
| stats avg(eval(round(duration,0))) AS Avg_Duration&lt;/P&gt;

&lt;P&gt;[&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.5/Search/Usestatswithevalexpressionsandfunctions"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.5/Search/Usestatswithevalexpressionsandfunctions&lt;/A&gt;]&lt;/P&gt;

&lt;P&gt;This especially works well when you are using a split by statement.&lt;BR /&gt;
EG:&lt;BR /&gt;
| stats avg(eval(duration(count,0))) AS Avg_Duration by something&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 15:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/round-fuction-usage-for-avg-command-output/m-p/63347#M180279</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2019-04-03T15:35:15Z</dc:date>
    </item>
  </channel>
</rss>

