Interview Prep/Monitoring & Observability/Alerting and On-Call Design

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 →

  1. 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}
  1. Alternatively expose a counter from the app (auth_failures_total{reason}), which is better long term.
  2. For Elastic, use Watcher or Kibana alerting rules.
  3. 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.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Alerting and On-Call Design