<?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: Why is bin command creating too many bins? Issue with 5-minute segments in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343195#M12774</link>
    <description>&lt;P&gt;Splunk's bucketing, on time, is done considering starting point as 01/01/1970 00:00, hence the bucketing of 5 mins always takes minutes with multiplicating factor of 5 (0,5,10,15...). &lt;/P&gt;

&lt;P&gt;If you just want to two buckets with last 5 mins to now and last 10 mins to last 5 mins, you need to use other workarounds, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server* index=iis | addinfo| eval _time=if(_time&amp;lt;relative_time(info_min_time,"-5m@m"),relative_time(info_max_time,"@m"),relative_time(info_min_time,"-5m@m"))| stats count by _time, host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Nov 2017 18:13:35 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-11-03T18:13:35Z</dc:date>
    <item>
      <title>Why is bin command creating too many bins? Issue with 5-minute segments</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343192#M12771</link>
      <description>&lt;P&gt;I have the same problem that is unanswered &lt;A href="https://answers.splunk.com/answers/240766/the-bins-option-on-bucket.html"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I'm trying to do stats on the last 10 minutes of data by two separate 5 minute buckets.&lt;/P&gt;

&lt;P&gt;My command looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=servers* index=iis | bin _time bins=2 | stats count as Request by _time, host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I run this for the last 10 minutes I expect 2 separate 5 minute buckets.  If my query starts on an even 5 minute interval like 1:05-1:15, it works fine but the buckets expect even 5 minute increments and if I run 1:02-1:12, it will create a "1:00" bucket for the requests between 1:00 and 1:05, a "1:05" bucket for the 1:05-1:10 requests, and a "1:10" bucket for the 1:10-1:15 requests.  That is 3 buckets of different sizes.&lt;/P&gt;

&lt;P&gt;Using the span=5 minutes doesn't help either.&lt;/P&gt;

&lt;P&gt;I tried just using the epoch number like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval Time=_time | bin Time bins=2 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was trying to stop Splunk from treating the _time field specially but it put everything into a single bin.&lt;/P&gt;

&lt;P&gt;How can I get Splunk to just create 2 evenly sized/spanned buckets?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 16:34:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343192#M12771</guid>
      <dc:creator>FeatureCreeep</dc:creator>
      <dc:date>2017-11-03T16:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why is bin command creating too many bins? Issue with 5-minute segments</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343193#M12772</link>
      <description>&lt;P&gt;can you clarify what isn't working about &lt;CODE&gt;|bin span=5min _time&lt;/CODE&gt; You may also find &lt;CODE&gt;|convert ctime(_time) as time&lt;/CODE&gt; useful because sometimes it comes out as epoch format. convert has a 'timeformat=' property also to help output in preferred syntax&lt;/P&gt;

&lt;P&gt;btw.. bins doesn't force the number of bins it sets a limit&lt;/P&gt;

&lt;P&gt;binsSyntax: bins=Description: Sets the maximum number of bins to discretize into.&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Bin"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Bin&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 17:33:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343193#M12772</guid>
      <dc:creator>jgbricker</dc:creator>
      <dc:date>2017-11-03T17:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why is bin command creating too many bins? Issue with 5-minute segments</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343194#M12773</link>
      <description>&lt;P&gt;It won't create just 2 bins.  Notice that the query goes back 10 minutes and the span is 5 minutes, but I still get 3 buckets.  It's the same if I use "bins=2"&lt;/P&gt;

&lt;P&gt;This query: host=server* index=iis | bin span=5min _time  | stats count by _time, host&lt;/P&gt;

&lt;P&gt;Run for this time: (11/3/17 1:37:17.000 PM to 11/3/17 1:47:17.000 PM)&lt;/P&gt;

&lt;P&gt;Returns these results:&lt;/P&gt;

&lt;P&gt;_time   host    count&lt;BR /&gt;
2017-11-03 13:35:00 server01    7339&lt;BR /&gt;
2017-11-03 13:40:00 server01    12910&lt;BR /&gt;
2017-11-03 13:45:00 server01    6432&lt;BR /&gt;
2017-11-03 13:35:00 server02    7402&lt;BR /&gt;
2017-11-03 13:40:00 server02    14509&lt;BR /&gt;
2017-11-03 13:45:00 server02    6167&lt;BR /&gt;
2017-11-03 13:35:00 server03    7034&lt;BR /&gt;
2017-11-03 13:40:00 server03    13665&lt;BR /&gt;
2017-11-03 13:45:00 server03    6273&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 17:51:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343194#M12773</guid>
      <dc:creator>FeatureCreeep</dc:creator>
      <dc:date>2017-11-03T17:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why is bin command creating too many bins? Issue with 5-minute segments</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343195#M12774</link>
      <description>&lt;P&gt;Splunk's bucketing, on time, is done considering starting point as 01/01/1970 00:00, hence the bucketing of 5 mins always takes minutes with multiplicating factor of 5 (0,5,10,15...). &lt;/P&gt;

&lt;P&gt;If you just want to two buckets with last 5 mins to now and last 10 mins to last 5 mins, you need to use other workarounds, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server* index=iis | addinfo| eval _time=if(_time&amp;lt;relative_time(info_min_time,"-5m@m"),relative_time(info_max_time,"@m"),relative_time(info_min_time,"-5m@m"))| stats count by _time, host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Nov 2017 18:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343195#M12774</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-03T18:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why is bin command creating too many bins? Issue with 5-minute segments</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343196#M12775</link>
      <description>&lt;P&gt;Perfect!  This information should be in the "bin" documentation.  Your workaround strategy worked great though a few min and maxes were backwards that I corrected.  Thanks!&lt;/P&gt;

&lt;P&gt;Here is the updated workaround:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server* index=iis | addinfo| eval _time=if(_time&amp;lt;relative_time(info_max_time,"-5m@m"),relative_time(info_min_time,"@m"),relative_time(info_max_time,"-5m@m"))  | stats count by _time, host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Nov 2017 19:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Why-is-bin-command-creating-too-many-bins-Issue-with-5-minute/m-p/343196#M12775</guid>
      <dc:creator>FeatureCreeep</dc:creator>
      <dc:date>2017-11-03T19:49:56Z</dc:date>
    </item>
  </channel>
</rss>

