alert_log_context
Pulls the Loki log streams that match a firing Prometheus alert, using shared labels to surface correlated error logs for faster root-cause analysis.
Instructions
[READ][cross-signal] Correlate a firing Prometheus alert to its Loki log streams.
Reads the firing alert's labels from the Prometheus target, maps the Loki-friendly ones (namespace, job, service, app, container, pod, instance, component — first four, in that priority order) into a LogQL stream selector, and pulls the correlated error streams from the Loki target. Best-effort: label values are escaped into the selector and only labels the alert and Loki actually share will match.
Args: alertname: The firing alert's name (from firing_alerts / firing_alert_rca). hours: Lookback window in hours (capped at the tool's max lookback). target: Prometheus target name from config; omit for the default. loki_target: Loki target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hours | No | ||
| target | No | ||
| alertname | Yes | ||
| loki_target | No |