Hello everyone,
I’m trying to achieve the same kind of behaviour that we have with PrometheusRules in the sense that we are able to attach new PrometheusRules to an already existing Prometheus cluster, but for Loki Alerting Rules. The idea is to enable applications generate a new Alerting Rule on installation (or any other lifecycle step). We’ve tried to explore the existing OperatorHub.io | The registry for Kubernetes Operators to make use of their AlertingRule object, but following this comment Loki rule operator · Issue #3456 · grafana/loki · GitHub it would seem that is not possible to connect the k8 resources generated by the operator with a previously existing Loki solution.
My question is, if this is not possible, what is the best way to dynamically generate new Alerting Rules based on Loki log content? Through Grafana Alerting? Directly injecting the alerts to Loki via curl ?
Interesting, I see that the loki.rules.kubernetes it’s also compatible with grafana-agent, which would fit our needs. Although I still don’t see how can I generate alerts based on log content since PrometheusRules would generate alerts based on the Prometheus datasource , not the Loki one, is that correct?