count_over_time function to return values (Vector).error keyword in the mysql job over the last 5 minutes.count_over_time({job="mysql"} |= "error" [5m])$A > 50 (more than 50 error logs in 5 minutes)$A > 10 (more than 10 error logs in 5 minutes)$A < 5 to avoid oscillation near the threshold.${label_name} variable substitution.count_over_time({job="mysql"} |= "recovered" [5m]).count_over_time({job="ingress"} |= "error-code-500" [5m]) / count_over_time({job="ingress"} [5m]) * 100 > 5> 5 condition), recovery is determined.rate({job="node-logs"} [1m])instance="host-1") existed in previous cycles but cannot be found in the current and consecutive N cycles, a "no data" alert is triggered.
{{- if eq $status "firing" }}
error log count: {{ $value | printf "%.3f" }}
{{- range $x := $relates.R1}}
Loki log time: {{(nanoTime $x.Fields.__time__ 8).Format "2006-01-02T15:04:05Z07:00"}}
Loki Log line: {{$x.Fields.__log__}}
{{- end}}
{{- end}}