<?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: Rounding to -2 works but not -3? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299815#M90310</link>
    <description>&lt;P&gt;You should open a support case; I made a comment on the documentation page.&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2017 20:38:07 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-05-17T20:38:07Z</dc:date>
    <item>
      <title>Rounding to -2 works but not -3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299811#M90306</link>
      <description>&lt;P&gt;Working on a search that will monitor when the searches that populate a summary index run and I'm needing to round the epoch time of when the search started to the closest hour.&lt;/P&gt;

&lt;P&gt;| eval runtime=strftime(info_search_time, "%m/%d/%y %H")&lt;BR /&gt;
Appropriately groups things but doesn't allow me to perform further calculations on the time value&lt;BR /&gt;
I've also tried re-converting this timestamp to epoch using strptime(runtime,"%s") but it doesn't work unless I include the minute/second details... I haven't figured out how to replace those with zeros.&lt;/P&gt;

&lt;P&gt;| eval RUNTIME=round(info_search_time,0)&lt;BR /&gt;
appropriately removes the numbers to the right of the decimal, leaving just an integer.&lt;/P&gt;

&lt;P&gt;To my pleasant surprise, I found that:&lt;BR /&gt;
| eval RUNTIME=round(info_search_time,-2) &lt;BR /&gt;
rounds the epoch time to: ########00 &lt;/P&gt;

&lt;P&gt;But when I try:&lt;BR /&gt;
 | eval RUNTIME=round(info_search_time,-3)&lt;BR /&gt;
instead of getting  #######000, as I'd like, I'm getting -nan&lt;/P&gt;

&lt;P&gt;Any idea why rounding to -3 isn't allowed or if there's some other approach I should be trying?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:06:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299811#M90306</guid>
      <dc:creator>kearaspoor</dc:creator>
      <dc:date>2020-09-29T14:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding to -2 works but not -3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299812#M90307</link>
      <description>&lt;P&gt;If all you need is to round the value of info_search_time rounded to hour, use the bucket command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| bucket span=1h info_search_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It'll keep the value in epoch and round/bucket it to hour length.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:06:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299812#M90307</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T14:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding to -2 works but not -3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299813#M90308</link>
      <description>&lt;P&gt;Check out the accepted answer in this post:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/200468/round-problem.html"&gt;https://answers.splunk.com/answers/200468/round-problem.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I have tested this (see screenshot)&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2953i699D5A1412502CCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 20:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299813#M90308</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2017-05-17T20:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding to -2 works but not -3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299814#M90309</link>
      <description>&lt;P&gt;The comment made by  somesoni2, recommending the bucket command worked like a charm but I can't accept it as the correct answer because it was posted as a comment. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;  If it gets moved I'll accept it as a great answer.  Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 20:27:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299814#M90309</guid>
      <dc:creator>kearaspoor</dc:creator>
      <dc:date>2017-05-17T20:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding to -2 works but not -3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299815#M90310</link>
      <description>&lt;P&gt;You should open a support case; I made a comment on the documentation page.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 20:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299815#M90310</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-17T20:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding to -2 works but not -3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299816#M90311</link>
      <description>&lt;P&gt;@kearaspoor - I have moved somesoni2's comment to an answer that you can accept. Thanks for leaving that comment saying it helped you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 21:03:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rounding-to-2-works-but-not-3/m-p/299816#M90311</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-05-17T21:03:07Z</dc:date>
    </item>
  </channel>
</rss>

