<?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 not overwrite time modifiers with time bins in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259164#M21497</link>
    <description>&lt;P&gt;Just lie to Splunk about your &lt;CODE&gt;time&lt;/CODE&gt; value, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... earliest=-12h@m | eval _time = _time - (60 * tonumber(strftime(now(),"%M"))) | bin _time span=1h | stats count BY field
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 05 Mar 2017 08:47:13 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-03-05T08:47:13Z</dc:date>
    <item>
      <title>how to not overwrite time modifiers with time bins</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259161#M21494</link>
      <description>&lt;P&gt;Let's say it is currently 4:37 pm.  I want to write a query that bins _time by 1 hour and where the last time bucket includes events between 3:37pm and the current time (4:37pm).&lt;/P&gt;

&lt;P&gt;However, the bin command in the following query seems to overwrite the @m time modifier and makes all of the time buckets start at minute 0 (ie 2:00pm - 3:00pm, 3:00pm - 4:00pm, ...). &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... ... ... earliest=-12h@m | bin _time span=1h | stats count by field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This makes the last bucket be 4:00pm - 5:00pm which means it only has 37 minutes worth of data while all other buckets have 60 minutes.  I want to be able to compare counts between this last bucket and the previous buckets but it won't work if the time sample sizes aren't all the same.  How can I change the query so that the last time bucket would be 3:47pm - 4:37pm? Any help is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 00:46:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259161#M21494</guid>
      <dc:creator>matthewb4</dc:creator>
      <dc:date>2017-01-25T00:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to not overwrite time modifiers with time bins</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259162#M21495</link>
      <description>&lt;P&gt;Good question &lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 13:50:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259162#M21495</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2017-01-26T13:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to not overwrite time modifiers with time bins</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259163#M21496</link>
      <description>&lt;P&gt;Here's how I generated some pseudo-random test data - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start="1/25/2017:13:59:21" increment=97m 
| append [| gentimes start="1/25/2017:13:28:52" increment=41m ]
| append [| gentimes start="1/25/2017:13:33:18" increment=17m ]
| eval _time = starttime
| table _time 
| sort 0 _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's how I created bins starting with the minute of the lowest results.  Just create a new field deltaTime with the time shifted by the minute value of the lowest results, then bin that, then raise up the bins by the same amount you lowered them. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats min(_time) as minTime
| eval minTime = relative_time(minTime,"@m")
| eval deltaTime = _time - minTime
| bin deltaTime as deltaBin span=1h
| eval deltaBin = deltaBin + minTime

| eval deltaBinF = strftime(deltaBin,"%Y-%m-%d %H:%M:%S")
| table _time deltaBin deltaBinF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The last two lines are just to present the results for review for testing.  &lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 16:34:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259163#M21496</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-01-26T16:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to not overwrite time modifiers with time bins</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259164#M21497</link>
      <description>&lt;P&gt;Just lie to Splunk about your &lt;CODE&gt;time&lt;/CODE&gt; value, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... earliest=-12h@m | eval _time = _time - (60 * tonumber(strftime(now(),"%M"))) | bin _time span=1h | stats count BY field
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Mar 2017 08:47:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/how-to-not-overwrite-time-modifiers-with-time-bins/m-p/259164#M21497</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-05T08:47:13Z</dc:date>
    </item>
  </channel>
</rss>

