<?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: In timechart, over what time interval does a point refer to? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224916#M66285</link>
    <description>&lt;P&gt;@viggor - Did one of the answers below help provide a solution your question? If yes, please click “Accept” below the best answer to resolve this post. If no, please leave a comment with more feedback. Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2016 22:31:21 GMT</pubDate>
    <dc:creator>aaraneta_splunk</dc:creator>
    <dc:date>2016-11-29T22:31:21Z</dc:date>
    <item>
      <title>In timechart, over what time interval does a point refer to?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224912#M66281</link>
      <description>&lt;P&gt;If I have a chart of the form &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;timechart span= T max(duration) as MaxLatency&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and a point &lt;CODE&gt;(x,y)&lt;/CODE&gt;, then over what time interval is &lt;CODE&gt;y&lt;/CODE&gt; computed? &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[x-T/2, x+T/2)&lt;/CODE&gt; , &lt;CODE&gt;[x, x+T)&lt;/CODE&gt;  or something else?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 19:36:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224912#M66281</guid>
      <dc:creator>viggor</dc:creator>
      <dc:date>2016-11-09T19:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: In timechart, over what time interval does a point refer to?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224913#M66282</link>
      <description>&lt;P&gt;Please add more details to your problem.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 21:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224913#M66282</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-09T21:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: In timechart, over what time interval does a point refer to?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224914#M66283</link>
      <description>&lt;P&gt;I don't believe it's described anywhere in the documentation, but here is my observation.&lt;/P&gt;

&lt;P&gt;The time interval depends upon the span and the timerange for the search. Consider the example &lt;CODE&gt;timechart span=10m count&lt;/CODE&gt; with time range of &lt;CODE&gt;last 4 hrs&lt;/CODE&gt;.  What Splunk does is start creating time bucket for every 10 mins from time 0 ( &lt;CODE&gt;1970/01/01 00:00&lt;/CODE&gt;) to latest of the time range ( &lt;CODE&gt;now&lt;/CODE&gt;), the time series will be &lt;CODE&gt;1970/01/01 00:00, 1970/01/01 10:00, 1970/01/01 20:00.......2016/11/09 15:30, 2016/11/09 15:40&lt;/CODE&gt;. Then it selects buckets based on time range, earliest and latest, and selects all buckets which includes the time range, including partial included buckets. So considering current time as &lt;CODE&gt;2016/11/09 15:48&lt;/CODE&gt;, and time range is &lt;CODE&gt;from 2016/11/09 11:48 to 2016/11/09 15:48&lt;/CODE&gt; , the buckets included in time range will be &lt;CODE&gt;2016/11/09 11:40, 2016/11/09 11:50, 2016/11/09 12:00.... 2016/11/09 15:30,2016/11/09 15:40&lt;/CODE&gt;). &lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 21:54:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224914#M66283</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-11-09T21:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: In timechart, over what time interval does a point refer to?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224915#M66284</link>
      <description>&lt;P&gt;As @somesoni2 mentions about it being undocumented but here is my shot at it. Bear the long answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I think a value &lt;CODE&gt;(x,y)&lt;/CODE&gt; in a time chart should be taken as a &lt;CODE&gt;y&lt;/CODE&gt; value inside the bucket &lt;CODE&gt;[x, x+T)&lt;/CODE&gt; where &lt;CODE&gt;x&lt;/CODE&gt; represents the bucket start time. Hence how to calculate &lt;CODE&gt;x&lt;/CODE&gt; (the starting bucket time of first bucket)  is of importance as &lt;CODE&gt;T&lt;/CODE&gt; will always be decided by the span you chose in timechart command. Hence I discuss below.&lt;/P&gt;

&lt;P&gt;Remember &lt;CODE&gt;x&lt;/CODE&gt; (if we take it as first bucket's start time so that first bucket becomes &lt;CODE&gt;[x, x+T)&lt;/CODE&gt; ) has to be such that it covers the first event of your data (as per time chosen for search query) as well as such that it can cover all your data (till end time) in buckets of &lt;CODE&gt;T&lt;/CODE&gt; spans.&lt;/P&gt;

&lt;P&gt;I took some samples as follows to test how will a timechart divide the buckets when as part of the query it is given search start time (earliest) as &lt;CODE&gt;StartInTimePicker&lt;/CODE&gt; , search end time (latest) as &lt;CODE&gt;EndInTimePicker&lt;/CODE&gt; and a span as &lt;CODE&gt;spanInSec&lt;/CODE&gt; while plotting the timechart . Based on multiple values that I chose here is how it divided and decided the &lt;CODE&gt;startBucketTime&lt;/CODE&gt; and after certain &lt;CODE&gt;T&lt;/CODE&gt; (spansInSec) the &lt;CODE&gt;LastBucketTime&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;StartTimeInTimePicker   EndTimeInTimePicker Span    StartBucketTime     LastBucketTime
2016-11-09 00:29:00   2016-11-09 01:20:00   30m  2016-11-09 00:00:00    2016-11-09 01:00:00
2016-11-09 00:29:00   2016-11-09 01:31:00   30m  2016-11-09 00:00:00    2016-11-09 01:30:00
2016-11-09 00:29:59   2016-11-09 00:59:59   30m     2016-11-09 00:00:00 2016-11-09 00:30:00
2016-11-09 00:29:00   2016-11-09 00:31:00   9s    2016-11-09 00:28:57   2016-11-09 00:30:54
2016-11-09 00:29:00   2016-11-09 00:31:04   9s    2016-11-09 00:28:57   2016-11-09 00:31:03
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is clear from above that most probably  &lt;STRONG&gt;ONLY&lt;/STRONG&gt; the &lt;CODE&gt;earliest&lt;/CODE&gt; , &lt;CODE&gt;latest&lt;/CODE&gt; and &lt;CODE&gt;span&lt;/CODE&gt; decides how buckets will be divided. Here is the formula below where you can replace the timePicker times (StartInTimePicker,  EndInTimePicker) per times of your choice in timepicker and the timechart span of your query (spansInSec) to see if the results show up the way they do in your timechart buckets statistics table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
| eval StartInTimePicker="2016-11-09 00:29:00"
| eval EndInTimePicker="2016-11-09 00:31:04"
| eval spansInSec=9
| eval setStartEpoch=strptime(StartInTimePicker, "%Y-%m-%d %H:%M:%S")
| eval setEndEpoch=strptime(EndInTimePicker, "%Y-%m-%d %H:%M:%S")
| eval startBucketTime=strftime((setStartEpoch - (setStartEpoch % spansInSec)), "%Y-%m-%d %H:%M:%S")
| eval endBucketTime=strftime((setEndEpoch - (setEndEpoch % spansInSec)), "%Y-%m-%d %H:%M:%S")
| table StartInTimePicker,EndInTimePicker, spansInSec, startBucketTime, endBucketTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Span is taken in seconds for understanding, however if you take span in minutes in timechart then fill the &lt;CODE&gt;spanInSec&lt;/CODE&gt; value in above query with equivalent sec values and try yourself.&lt;/P&gt;

&lt;P&gt;Once we have &lt;CODE&gt;startBucketTime&lt;/CODE&gt; and &lt;CODE&gt;endBucketTime&lt;/CODE&gt; it should be a simple task to represent &lt;CODE&gt;[x, x+T), [x+T, x+T+T), [x+T+T, x+T+T+T) ... [x+(n-1)T, x+nT)&lt;/CODE&gt; buckets as a loop of interval generation as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for( int ii=startBucketTime; ii&amp;lt;=endBucketTime; ii=ii+spanInSec)
   print "[ ii, ii+spanInSec)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is how I think bucket times are being generated to decide &lt;CODE&gt;[x, x+T)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 07:02:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224915#M66284</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-10T07:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: In timechart, over what time interval does a point refer to?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224916#M66285</link>
      <description>&lt;P&gt;@viggor - Did one of the answers below help provide a solution your question? If yes, please click “Accept” below the best answer to resolve this post. If no, please leave a comment with more feedback. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 22:31:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/In-timechart-over-what-time-interval-does-a-point-refer-to/m-p/224916#M66285</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-11-29T22:31:21Z</dc:date>
    </item>
  </channel>
</rss>

