<?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: how to delay results by a few minutes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53816#M13095</link>
    <description>&lt;P&gt;It's tough using the relative time operations for &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; to round to something larger than a minute, but smaller than an hour.  If I understand your request correctly, you'd like to be able to do something like &lt;CODE&gt;latest=h/15m@m&lt;/CODE&gt; or &lt;CODE&gt;latest=h/5m@m&lt;/CODE&gt; to say "Give me the current hour, rounded to the most recent 5/15 minute interval in said hour, rounded to the minute."&lt;/P&gt;

&lt;P&gt;I may have entirely misunderstood what you were looking for.  But, if I didn't here is an UGLY way of getting there using a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ search earliest=@h latest=@h+1m 
   | head 1 | addinfo 
   | eval td=(floor((now()-info_min_time)/900)*900)+info_min_time 
   | rename td as latest | fields latest 
] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Put that in your original search and it will, using the subsearch, evaluate out &lt;CODE&gt;latest&lt;/CODE&gt; to the time_t (seconds since 1/1/1970 00:00:00 GMT) of the end of the most recent 15-minute interval in the current hour.&lt;/P&gt;

&lt;P&gt;I'm not sure whether to be proud of this or not &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 17 May 2012 01:28:23 GMT</pubDate>
    <dc:creator>dwaddle</dc:creator>
    <dc:date>2012-05-17T01:28:23Z</dc:date>
    <item>
      <title>how to delay results by a few minutes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53814#M13093</link>
      <description>&lt;P&gt;I'm writing a search that is comparing the count of an event versus what happned one and two weeks ago.  My search looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index="monitoring" Metric=attemptSuccess earliest=@d 
  | timechart span="15m" sum(attemptSuccess) as today 
  | appendcols [ search index="monitoring" Metric=attemptSuccess earliest=-7d@d latest=-6d@d | timechart span="15m" sum(attemptSuccess) as lastweek | fields lastweek ]
  | appendcols [ search index="monitoring" Metric=attemptSuccess earliest=-14d@d latest=-13d@d | timechart span="15m" sum(attemptSuccess) as twoweeksago | fields twoweeksago ]
  | timechart span="15m" sum(today) as Today, sum(lastweek) as LastWeek, sum(twoweeksago) as TwoWeeksAgo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm having problems with the most current data point for "Today" - as I'm collecting the data for the last 15 minutes, the most recent results when visualized in a chart give an incorrect appearance of being low, when they're really a work in progress.  I know I'd want to add a "latest" clause in the search somehow, but I can't seem to get it working correctly.  Any suggestions how to best do this?  I've got data being collected every 5 minutes, so ideally this would offset my reading somewhere between 5 and 15 minutes.&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 21:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53814#M13093</guid>
      <dc:creator>dang</dc:creator>
      <dc:date>2012-05-16T21:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to delay results by a few minutes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53815#M13094</link>
      <description>&lt;P&gt;Does it work if you change the first line to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="monitoring" Metric=attemptSuccess earliest=@d latest=-15m@m
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 May 2012 01:12:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53815#M13094</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-05-17T01:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to delay results by a few minutes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53816#M13095</link>
      <description>&lt;P&gt;It's tough using the relative time operations for &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; to round to something larger than a minute, but smaller than an hour.  If I understand your request correctly, you'd like to be able to do something like &lt;CODE&gt;latest=h/15m@m&lt;/CODE&gt; or &lt;CODE&gt;latest=h/5m@m&lt;/CODE&gt; to say "Give me the current hour, rounded to the most recent 5/15 minute interval in said hour, rounded to the minute."&lt;/P&gt;

&lt;P&gt;I may have entirely misunderstood what you were looking for.  But, if I didn't here is an UGLY way of getting there using a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ search earliest=@h latest=@h+1m 
   | head 1 | addinfo 
   | eval td=(floor((now()-info_min_time)/900)*900)+info_min_time 
   | rename td as latest | fields latest 
] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Put that in your original search and it will, using the subsearch, evaluate out &lt;CODE&gt;latest&lt;/CODE&gt; to the time_t (seconds since 1/1/1970 00:00:00 GMT) of the end of the most recent 15-minute interval in the current hour.&lt;/P&gt;

&lt;P&gt;I'm not sure whether to be proud of this or not &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2012 01:28:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-delay-results-by-a-few-minutes/m-p/53816#M13095</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2012-05-17T01:28:23Z</dc:date>
    </item>
  </channel>
</rss>

