<?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 do I create a timechart with spans that aren't aligned to the start of a minute/hour/day etc? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438606#M124839</link>
    <description>&lt;P&gt;You can add/remove any arbitrary time-segment like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Search Here
[| makeresults 
 | rename COMMENT AS "This expands the window by 1 minute on each side"
 | addinfo 
 | eval search = "earliest=" . (info_min_time - 60) . " latest=" . (info_max_time + 60)
 | table search]
| timechart count span=1m
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 31 Oct 2018 18:39:21 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-10-31T18:39:21Z</dc:date>
    <item>
      <title>How do I create a timechart with spans that aren't aligned to the start of a minute/hour/day etc?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438604#M124837</link>
      <description>&lt;P&gt;I'm using &lt;CODE&gt;timechat&lt;/CODE&gt; to count the number of events per minute in a single value display: &lt;CODE&gt;search | timechart span=1m count&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This works fine. However, each time span is aligned to the top of the minute, meaning that the single value is only ever accurate when the search is conducted at the top of the minute. I want my single value to display the total number of requests in the last minute from &lt;EM&gt;now&lt;/EM&gt; and not the last &lt;EM&gt;whole&lt;/EM&gt; minute.&lt;/P&gt;

&lt;P&gt;For example, if the search is running at 12:15:39, the single value should show the count of events between 12:14:39 and 12:15:39, rather than the count from 12:14:00 to 12:15:00 (or, if using &lt;CODE&gt;partial=true&lt;/CODE&gt;, 12:15:00 to 12:15:39)&lt;/P&gt;

&lt;P&gt;Is &lt;CODE&gt;timechart&lt;/CODE&gt; suitable for this or do I need to use another method?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2018 02:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438604#M124837</guid>
      <dc:creator>lukemundy</dc:creator>
      <dc:date>2018-10-19T02:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a timechart with spans that aren't aligned to the start of a minute/hour/day etc?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438605#M124838</link>
      <description>&lt;P&gt;You can add/subtract an offset, run your timechart, then subtract/add it back. &lt;/P&gt;

&lt;P&gt;Here's a run-anywhere example... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal earliest=-610s 
| addinfo | eval delay=info_max_time % 60 | eval _time = _time - delay 
| timechart span=1m count  
| addinfo | eval delay=info_max_time % 60 | eval _time = _time + delay | fields - delay info*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Notes&lt;/P&gt;

&lt;P&gt;1) &lt;CODE&gt;timechart&lt;/CODE&gt; kills the calculated field, so you have to do it all over again, then delete the added fields as well.&lt;/P&gt;

&lt;P&gt;2) You can use &lt;CODE&gt;info_max_time&lt;/CODE&gt; or &lt;CODE&gt;info_min_time&lt;/CODE&gt;, depending on whether you are more concerned about aligning the start of the period or the end of the period.  They are functionally equivalent except for edge cases. &lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 21:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438605#M124838</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-10-26T21:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a timechart with spans that aren't aligned to the start of a minute/hour/day etc?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438606#M124839</link>
      <description>&lt;P&gt;You can add/remove any arbitrary time-segment like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Search Here
[| makeresults 
 | rename COMMENT AS "This expands the window by 1 minute on each side"
 | addinfo 
 | eval search = "earliest=" . (info_min_time - 60) . " latest=" . (info_max_time + 60)
 | table search]
| timechart count span=1m
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Oct 2018 18:39:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-timechart-with-spans-that-aren-t-aligned-to/m-p/438606#M124839</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-10-31T18:39:21Z</dc:date>
    </item>
  </channel>
</rss>

