The security team wants alerts on repeated failed logins found only in application logs. How do you do it?
IntermediateScenarioAlerting and On-Call Design
Answer
Situation read → The signal exists in logs, but alerting is cheaper and faster on metrics.
What I'd do →
- With Loki, use the ruler with a LogQL metric query:
- alert: BruteForceLogin
expr: sum by (client_ip) (count_over_time({app="auth"} |= "login failed" | logfmt [5m])) > 50
for: 2m
labels: {severity: page, team: security}
- Alternatively expose a counter from the app (
auth_failures_total{reason}), which is better long term. - For Elastic, use Watcher or Kibana alerting rules.
- Route to the security receiver and include client IP and user in annotations.
Why → Rules over logs work, but a first-class metric is cheaper and does not depend on log parsing.
Interview tip → Mention cardinality: per-IP labels are fine in an alert expression but not as a stored metric label.
More on Alerting and On-Call Design
Your on-call engineers receive 300 alerts a night and have started ignoring the pager. How do you fix it?IntermediateYou are asked to design alerting for a brand-new HTTP service from scratch. What do you alert on?BeginnerA "CPU above 90%" alert wakes someone at 3 a.m., but users saw no impact. What do you change?BeginnerA new hire asks: "Should we page on symptoms or causes?" How do you answer with an example?BeginnerDesign burn-rate alerts for a 99.9% availability SLO over 30 days.AdvancedPayments and platform teams share one Prometheus and one Alertmanager. How do you route alerts to the right team and severity?Intermediate