I'm very stuck, how can I have a streamstats function accumulate a total and reset at 9.00am every day? It's straightforward if I have an event at 9.00am, but if the last event was at say 8.55am, t...
See more...
I'm very stuck, how can I have a streamstats function accumulate a total and reset at 9.00am every day? It's straightforward if I have an event at 9.00am, but if the last event was at say 8.55am, then the next event is at 9.15am, the reset occurs, however, it will continue to reset for all events which occur between 9.00am and 9.59am as the statement remains true throughout the hour below in my example. index=main | eval Hour=strftime(_time,"%H") | streamstats reset_after="("Hour==09")" sum(Result) as Total I tried to experiment with specifying the minute, but the same situation exists if the 9.00am minute does not exist. index=main | eval Hour=strftime(_time,"%H%M") | streamstats reset_after="("Hour==0900")" sum(Result) as Total I think I need to either make a lookup to create an event every 9 am for each day, but I couldn't figure that out if the time range was greater than one day. I experimented with makeresults to create an event, but this needed an append which messed up all of my other parts of the query. I think the most elegant way to do this is to have an event created for every 9 am before the query is made, but I can't figure it out, any advice/ideas are welcomed! Dave