count_over_time, rate, sum to convert logs into numeric series for threshold evaluation.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 prevent flapping near the threshold.${label_name} variable substitution.count_over_time({job="mysql"} |= "recovered" [5m]).rate({job="ingress"} |= "500" [1m]) / rate({job="ingress"} [1m]) * 100 > 5> 5 condition is no longer met).rate({job="node-logs"} [1m])instance="host-1") existed in previous cycles but cannot be found in the current and N consecutive cycles, a "no data" alert is triggered.{job="mysql"} |= "error").count_over_time(...).[5m]) should be moderate. Too large a range leads to slow queries, while too small a range may cause high data volatility.{...}) as much as possible to reduce the amount of data scanned.