<?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: bin with specific buckets in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458471#M168103</link>
    <description>&lt;P&gt;I figure I can do things like this:&lt;/P&gt;

&lt;P&gt;index=*  ..... | &lt;EM&gt;**eval runtimewithmax=case(runTime &amp;gt; 60, 61, true(), runTime)&lt;/EM&gt;* | bucket _time span=1h | bin span=20 runtimewithmax | eval epoachtime=_time | stats count as eventcount by epoachtime, context, sourcetype, gdpr, index, path, runtimewithmax &lt;/P&gt;

&lt;P&gt;but I was hoping there is a better way.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:37:09 GMT</pubDate>
    <dc:creator>dtakacssplunk</dc:creator>
    <dc:date>2020-09-29T20:37:09Z</dc:date>
    <item>
      <title>bin with specific buckets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458470#M168102</link>
      <description>&lt;P&gt;Hello I want to use bin to categorize my runtimes into specific buckets.  lets' say I want to show runtime and bucketize it every hour into buckets 0-20, 20-40, 40-60, 60 - maxtime.  How do I do this?&lt;/P&gt;

&lt;P&gt;Currently my query is like this:&lt;BR /&gt;
index=* ..... | bucket _time span=1h | bin span=20  end=200 runTime | eval epoachtime=_time | stats count by epoachtime, runTime | makecontinuous runTime | fillnull count&lt;/P&gt;

&lt;P&gt;and I get the following result :&lt;/P&gt;

&lt;P&gt;epoachtime  runTime count&lt;BR /&gt;
1532620800  0-20    2263&lt;BR /&gt;
1532624400  0-20    3097&lt;BR /&gt;
1532628000  0-20    2249&lt;BR /&gt;
1532617200  0-20    45&lt;BR /&gt;
1532631600  0-20    1615&lt;BR /&gt;
1532631600  20-40   3&lt;BR /&gt;
1532631600  40-60   1&lt;BR /&gt;
    60-80   0&lt;BR /&gt;
    80-100  0&lt;BR /&gt;
    100-120 0&lt;BR /&gt;
    120-140 0&lt;BR /&gt;
    140-160 0&lt;BR /&gt;
    160-180 0&lt;BR /&gt;
    180-200 0&lt;BR /&gt;
    200-220 0&lt;BR /&gt;
1532620800  220-240 1&lt;BR /&gt;
1532631600  240-260 2&lt;BR /&gt;
1532620800  260-280 1&lt;BR /&gt;
1532631600  260-280 1&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:37:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458470#M168102</guid>
      <dc:creator>dtakacssplunk</dc:creator>
      <dc:date>2020-09-29T20:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: bin with specific buckets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458471#M168103</link>
      <description>&lt;P&gt;I figure I can do things like this:&lt;/P&gt;

&lt;P&gt;index=*  ..... | &lt;EM&gt;**eval runtimewithmax=case(runTime &amp;gt; 60, 61, true(), runTime)&lt;/EM&gt;* | bucket _time span=1h | bin span=20 runtimewithmax | eval epoachtime=_time | stats count as eventcount by epoachtime, context, sourcetype, gdpr, index, path, runtimewithmax &lt;/P&gt;

&lt;P&gt;but I was hoping there is a better way.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458471#M168103</guid>
      <dc:creator>dtakacssplunk</dc:creator>
      <dc:date>2020-09-29T20:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: bin with specific buckets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458472#M168104</link>
      <description>&lt;P&gt;If I understand your question correctly, you want to see events classified by groups of runtimes.&lt;/P&gt;

&lt;P&gt;You might try the eval case function like&lt;BR /&gt;
    ... | eval timeBin=case(runTime &amp;lt; 20, "0-20", runTime &amp;lt; 40, "0-40"...&lt;/P&gt;

&lt;P&gt;This would give you a new field timeBin that would have those string values you could use to group by, etc.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/ConditionalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 23:34:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458472#M168104</guid>
      <dc:creator>nplamondon</dc:creator>
      <dc:date>2018-07-26T23:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: bin with specific buckets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458473#M168105</link>
      <description>&lt;P&gt;yes I was thinking of the solution you proposed, but I wish the bin function min / max arguments somehow could be used to achieve something like it...  &lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 23:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/bin-with-specific-buckets/m-p/458473#M168105</guid>
      <dc:creator>dtakacssplunk</dc:creator>
      <dc:date>2018-07-26T23:38:20Z</dc:date>
    </item>
  </channel>
</rss>

