<?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 edit my search to return one count for each minute that has &amp;lt; 10 events, including minutes where event count is 0? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133758#M36529</link>
    <description>&lt;P&gt;Are you shure it is working? Replace the  &lt;STRONG&gt;= &amp;lt;&lt;/STRONG&gt; by  &lt;STRONG&gt;&amp;lt;=&lt;/STRONG&gt;, and let me know if this ok.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Apr 2015 07:47:32 GMT</pubDate>
    <dc:creator>stephanefotso</dc:creator>
    <dc:date>2015-04-13T07:47:32Z</dc:date>
    <item>
      <title>How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133756#M36527</link>
      <description>&lt;P&gt;Hi guys. &lt;/P&gt;

&lt;P&gt;I need some help to to understand what's wrong with this search. I want this one to return one count for each minute that has &amp;lt; 10 events, it does but not for the minutes where the event count is 0. Any idea what to change in order to get it working? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype = access_combined | bucket span=1m _time | stats count as requests_per_minute by _time | where requests_per_minute  = &amp;lt;10 | stats count as downtime_duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Apr 2015 07:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133756#M36527</guid>
      <dc:creator>Norling80</dc:creator>
      <dc:date>2015-04-13T07:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133757#M36528</link>
      <description>&lt;P&gt;HI,&lt;BR /&gt;
Try with this!&lt;/P&gt;

&lt;P&gt;This query display all count by minute!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype = access_combined   |  stats count as requests_per_minute by _time | where requests_per_minute &amp;lt;=10 | timechart span=1m count as downtime_duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or try with&lt;BR /&gt;
This query display  all count (also 0) by minute, but the lines that contain count Not equal 0 are display with  value = 1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype = access_combined  | bucket span=1m _time  |  stats count as requests_per_minute by _time | where requests_per_minute &amp;lt;=10 | timechart span=1m count as downtime_duration  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Apr 2015 07:46:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133757#M36528</guid>
      <dc:creator>ngatchasandra</dc:creator>
      <dc:date>2015-04-13T07:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133758#M36529</link>
      <description>&lt;P&gt;Are you shure it is working? Replace the  &lt;STRONG&gt;= &amp;lt;&lt;/STRONG&gt; by  &lt;STRONG&gt;&amp;lt;=&lt;/STRONG&gt;, and let me know if this ok.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2015 07:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133758#M36529</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-04-13T07:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133759#M36530</link>
      <description>&lt;P&gt;Thanks, but unfortunately is still does not count the minutes with 0 events, any ideas on how to include that as-well? And I also want this in a statistical output with a simple | stats count that returns the amount on minutes that had &amp;lt;10 events (including the minutes with 0 events). &lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2015 12:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133759#M36530</guid>
      <dc:creator>Norling80</dc:creator>
      <dc:date>2015-04-13T12:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133760#M36531</link>
      <description>&lt;P&gt;To see the problem you have to remember that &lt;CODE&gt;stats count as requests_per_minute by _time&lt;/CODE&gt; is really nice and dumb.    Rows come into it from the left and for each value of _time that stats sees, it'll make an output row, and count up how many input rows had that value of time.   However for _time values for which no events come in,  it will do  nothing.    In other words it has no idea that _time is a continuous value and that it should be making other rows with count=0 for _time values that it has never seen. &lt;/P&gt;

&lt;P&gt;Fortunately there is a function that is excellent at creating these blank rows for you, timechart.   So this should give you what you need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype = access_combined | timechart count as requests_per_minute span=1min |  where requests_per_minute &amp;lt;=10 | stats count as downtime_duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Apr 2015 17:54:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133760#M36531</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2015-04-13T17:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133761#M36532</link>
      <description>&lt;P&gt;This is the query that display the count of events for each  minute :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_ineternal | timechart  span=1m count as requests_per_minute 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;let us filter:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_ineternal | timechart  span=1m count as requests_per_minute |  where requests_per_minute  &amp;lt;10 | stats count as downtime_duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Let us count the amount on minutes that had &amp;lt;10 events (including the minutes with 0 events).&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | timechart  span=1m count as requests_per_minute  |  where requests_per_minute  &amp;lt;10 | stats count as downtime_duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your final request will count also the minutes with 0 events  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined | timechart  span=1m count as requests_per_minute   |  where requests_per_minute  &amp;lt;10 | stats count as downtime_duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Apr 2015 21:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133761#M36532</guid>
      <dc:creator>ngatchasandra</dc:creator>
      <dc:date>2015-04-13T21:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133762#M36533</link>
      <description>&lt;P&gt;If you want count the minutes that have zero events try like this :&lt;BR /&gt;
&lt;CODE&gt;...| timechart span=1m count as requests_per_minute by _time | where requests_per_minute = 0 | stats count as " count of minutes that have zero events"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;if else see answer of Mr sideview.&lt;/P&gt;

&lt;P&gt;but if you want  count the minutes with 0 events and the amount on minutes that had &amp;lt;10 events  try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype = access_combined | timechart count as requests_per_minute span=1min |  where requests_per_minute &amp;lt;=10 | stats count as downtime_duration | appendcols [search sourcetype = access_combined | timechart count as requests_per_minute span=1min |  where requests_per_minute =0 | stats count as " count of minutes that have zero events" ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Apr 2015 08:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133762#M36533</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2015-04-14T08:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133763#M36534</link>
      <description>&lt;P&gt;Thanks Ngatchasandra, that did the trick. one more question about this &lt;/P&gt;

&lt;P&gt;The downtime_duration is not displayed as a field in the log, so how do I do if I want to see the downtime_duration on different HostNames in my Jboss accesslog, something like this... &lt;/P&gt;

&lt;P&gt;index=jboss_accesslog | timechart count as requests_per_minute by _time span=1m |  where requests_per_minute  &amp;lt;10 | &lt;STRONG&gt;stats count as downtime_duration by HostName&lt;/STRONG&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133763#M36534</guid>
      <dc:creator>Norling80</dc:creator>
      <dc:date>2020-09-28T19:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133764#M36535</link>
      <description>&lt;P&gt;You can do this  with &lt;STRONG&gt;streamstats&lt;/STRONG&gt; command  and &lt;STRONG&gt;join&lt;/STRONG&gt; command (allow you to macth to his downtime_duration):    try to run query that follow:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined| timechart span=1m count as requests_per_minute| where requests_per_minute &amp;lt;10 | streamstats count as downtime_duration by HostName |join  [search sourcetype=access_combined | table HostName]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Apr 2015 03:33:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133764#M36535</guid>
      <dc:creator>ngatchasandra</dc:creator>
      <dc:date>2015-04-16T03:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133765#M36536</link>
      <description>&lt;P&gt;Thanks, almost there I think. I did not get any result in return when i did as you suggested so I  tried a couple of different things and did some minor modifications to it, &lt;/P&gt;

&lt;P&gt;sourcetype=access_combined | timechart span=1m count as requests_per_minute | where requests_per_minute &amp;lt;100 | stats count as Downtime_Duration | join [search sourcetype=access_combined | table HostName]&lt;/P&gt;

&lt;P&gt;gave this result in the dashboard table view: &lt;BR /&gt;
&lt;STRONG&gt;Downtime_Duration         HostName&lt;/STRONG&gt;&lt;BR /&gt;
13                                                  hostname.domain.com&lt;/P&gt;

&lt;P&gt;So the only problem right now is that I only see one HostName in the table and not all of them, worth to mention is that the hostnames are added in the base search like this HostName="hostname1" OR HostName="Hostname2" etc.... &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:32:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133765#M36536</guid>
      <dc:creator>Norling80</dc:creator>
      <dc:date>2020-09-28T19:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133766#M36537</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I think that i resolved your probllem now with &lt;STRONG&gt;untable&lt;/STRONG&gt; command which let me to  obtain that you want! Only run the query that folllow:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=access_combined | timechart span=1m count as requests_per_minute by Hostname |untable _time  Hostname requests_per_minute | where requests_per_minute &amp;lt;100 | stats count as Downtime_Duration by Hostname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is work fine.&lt;/P&gt;

&lt;P&gt;I tried to test it with _internal index like follow:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal | timechart span=1m count as requests_per_minute by sourcetype |untable _time  sourcetype requests_per_minute | where requests_per_minute &amp;lt;100 | stats count as Downtime_Duration by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Apr 2015 21:12:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133766#M36537</guid>
      <dc:creator>ngatchasandra</dc:creator>
      <dc:date>2015-04-16T21:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133767#M36538</link>
      <description>&lt;P&gt;Please, don't forget to vote me!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2015 17:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133767#M36538</guid>
      <dc:creator>ngatchasandra</dc:creator>
      <dc:date>2015-04-17T17:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133768#M36539</link>
      <description>&lt;P&gt;I believe that y'all are way overthinking this; what is wrong with this?&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
sourcetype = access_combined | bucket _time span=1m | stats count AS requests_per_minute BY _time,HostName | stats count(eval(requests_per_minute&amp;lt;10)) AS downtime_duration BY HostName&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133768#M36539</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-09-28T19:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return one count for each minute that has &lt; 10 events, including minutes where event count is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133769#M36540</link>
      <description>&lt;P&gt;It will end up only counting times when the requests per minute is less than 10 but also greater than 0.    Basically if you think about time periods in which there are zero events, for these _time values there will be no rows at all coming into your stats command.   See my answer for more details.  &lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 04:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-one-count-for-each-minute-that/m-p/133769#M36540</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2015-04-22T04:28:36Z</dc:date>
    </item>
  </channel>
</rss>

