1

I'm trying to trigger an alert using Grafana Loki. If no log seen by 5AM, each day need to trigger an alert.

Here is the query I came up with. I dont think its correct as the offset 16h25m: shifts the time range by 16 hours and 25 minutes.

count_over_time({env="dev", app="test-app"} |="YOUR Test Keyword" [1d] offset 16h25m) == 0

Any Grafana Loki expert who has any suggestions.

Avin Varghese
  • 4,340
  • 1
  • 22
  • 31

1 Answers1

0

You can use this query

count_over_time({env="dev", app="test-app"} |="YOUR Test Keyword" [17h])) == 0
 and on() hour() == 17 and minute()>=0<=5

to trigger an alert if no logs for specified selector are seen for last 17 hours at 17:00 (5 pm).

If you want some other time, replace range selector [17h] and values for comparison of time functions accordingly.

markalex
  • 8,623
  • 2
  • 7
  • 32