Alert on every error message in logs with loki


I could not find a way to issue an alert on EVERY error line in logs. There are several similar questions in this forum, but no answers.

Is it plainly impossible?

Hi! Alerts that use Loki must alert on something numerical. For example, the number of logs matching some string over a time range. I don’t think its possible to create a separate alert for each log occurrence, and I’m not such an alert rule would be helpful as you could end up with 1000s of firing alerts.

I’m pretty sure I will not; in case of firing 1000s of alerts it would be good to have some throttling, but lack of ability to fire alert on each error is kind of disappointing

The issue is that as a feature it needs to be able to support both small and large volumes of alert rules as Loki has such a wide range of users. Throttling would help, but it adds additional questions such as which alerts should be throttled, should it be possible to prioritize alerts, override active throttling, etc.

My recommendation would be to create an alert with count_over_time and then create an annotation that links to the explore page in Grafana.

Okay, I’ll try. Should it be in loki or in grafana?