Grifana Groupby timestamp 24 hr


I am trying to find sudden increase/decrease in logs.So , I applied count group by 24 hr but it is aggregating count from 5:30 to next day 5:30. I want it to be current hour - 24 hr so that I can apply meaning alerts. Below is the screenshot.

NOTE: I am in +5:30 timezone.

@fadjar340 Can you help me in this matter?


Try to set the Time Range on the top right of the dashboard to tast 24h, and make the alerts following the time range accordingly. If you want to no one to change the Time Range, just set hide the time picker in the Dashboard properties.



DOn’t forget to save the dashboard…

@fadjar340, I have changed as you mentioned but still grifana calculate derivative at 00:00 which is 5:30 at my time

Above attached are my graph and my alert

So I am ingesting data on hourly bases in elasticsearch and want to find any peaks. So I am taking derivative of past 24 hrs(frequency of logs varies according to time) for bigger dataset. However, here grifana calculating derivative from 00:00 to 23:59 which is making my current day derivative really low and hence alarm is triggering

What I want is to calculate derivative like current time -24 to current_time which is not happening even when using above mentioned method.

How can I achieve this??

Thanks in advance

Please make the min interval time is 1h in the Query Option and the evaluation period to 1h for 24h in the alert rule

@fadjar340, changed as below

It is still calculating derivative at 5:30. Do I have to wait for net hours??

It will calculate until the new data is coming… The visualization is depends on the data timestamp…

@fadjar340, Data is loaded for every hour and I have waited for 1 day but graph still showing the same.

The reason is that for yesterday is calculate count for whole 24 hrs but as day changes it start count from 0 and hence derivative on count is also dropping from 2000 to -2000.

Your suggestion still did not affect the graph and derivative as shown in screenshots.

@fadjar340 , anything on this? Why it is not calculating as expected. I am using Grifana 6.3

As my experience, I didn’t have any wrong calculation.
I think you need to try change the Conditions OF: query(A,24h,now), perhaps it’s helps…
Also, try to use the latest Grafana 7.2.1

Hi @fadjar340,

I have used another approach now. I want to confirm whether is it good.

Now I am grouping my count hourly basis and applying moving average with window 24 to get the average of past 24 hours.

What do you mean with Window 24? Is it TIme range or Min Interval ?

I am now getting count on hourly basis and then applying moving average with its window = 24 . So that it calculate average from last 24 count points. like below

In graph, I want to create alert on last point(by time) when it crosses threshold.

I am still unable to get that. As you can see, In test rule, I am getting random values.