Created
November 7, 2023 21:12
example loki recording rule and alert configmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: loki-additional-rules | |
annotations: | |
argocd.argoproj.io/compare-options: IgnoreExtraneous | |
labels: | |
loki_rule: 'true' | |
data: | |
additional-loki-rules.yaml: | | |
groups: | |
- name: additional_loki_rules | |
interval: 1m | |
rules: | |
- record: job:loki:kex:application:sum_rate | |
expr: sum(rate({app="kubernetes-event-exporter"} | json | kind="Application" [5m])) by (name) | |
labels: | |
cluster: loki | |
- name: additional_loki_alerts | |
rules: | |
- alert: TooManyEventsInTheApplication | |
expr: | | |
sum(rate({app="kubernetes-event-exporter"} | json | kind="Application" [5m])) by (name) > 0.05 | |
for: 0s | |
labels: | |
severity: page | |
annotations: | |
summary: High request latency |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you define to populate the rules using loki.rules of the HELM chart
then your syntax would be: