From fbd74104bdaa63bd9a89e2967a9b1f634d71d562 Mon Sep 17 00:00:00 2001 From: "Johnny K." Date: Mon, 12 Jan 2026 13:54:28 -0600 Subject: [PATCH] alerting docs: update configure alert state history Update the Configure Alert State History docs with multi configurations. --- .../configure-alert-state-history/index.md | 70 ++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/docs/sources/alerting/set-up/configure-alert-state-history/index.md b/docs/sources/alerting/set-up/configure-alert-state-history/index.md index dfb476b69ef..556887d3144 100644 --- a/docs/sources/alerting/set-up/configure-alert-state-history/index.md +++ b/docs/sources/alerting/set-up/configure-alert-state-history/index.md @@ -120,9 +120,13 @@ GRAFANA_ALERTS{alertstate='firing'} ## Configure Loki and Prometheus for alert state -You can also configure both Loki and Prometheus to record alert state changes for your Grafana-managed alert rules. +You can configure multiple backends to record alert state changes for your Grafana-managed alert rules. The `primary` backend serves state history queries and must be either `annotations` or `loki`. -Start with the same setup steps as shown in the previous [Loki](#configure-loki-for-alert-state) and [Prometheus](#configure-prometheus-for-alert-state-alerts-metric) sections. Then, adjust your Grafana configuration as follows: +### Loki with Prometheus + +You can use Loki as the primary backend for state history queries and write to Prometheus for metrics-based monitoring. + +Start with the setup steps from [Loki](#configure-loki-for-alert-state) and [Prometheus](#configure-prometheus-for-alert-state-alerts-metric). Then, adjust your Grafana configuration as follows: ```toml [unified_alerting.state_history] @@ -137,4 +141,66 @@ secondaries = prometheus # Target data source UID for writing alert state changes. prometheus_target_datasource_uid = +[feature_toggles] +enable = alertingCentralAlertHistory +``` + +### Annotations with Loki + +You can use annotations (stored in Grafana's database) as the primary backend and write to Loki for external storage and advanced querying. + +Start with the setup steps from [Loki](#configure-loki-for-alert-state). Then, adjust your Grafana configuration as follows: + +```toml +[unified_alerting.state_history] +enabled = true +backend = multiple + +primary = annotations + +secondaries = loki +# URL of the Loki server. +loki_remote_url = http://localhost:3100 +``` + +### Annotations with Prometheus + +You can use annotations as the primary backend and write to Prometheus for metrics-based monitoring. + +Start with the setup steps from [Prometheus](#configure-prometheus-for-alert-state-alerts-metric). Then, adjust your Grafana configuration as follows: + +```toml +[unified_alerting.state_history] +enabled = true +backend = multiple + +primary = annotations + +secondaries = prometheus +# Target data source UID for writing alert state changes. +prometheus_target_datasource_uid = +``` + +### Loki with multiple secondaries + +You can configure Loki as the primary backend with multiple secondary backends for comprehensive redundancy and monitoring. + +Start with the setup steps from [Loki](#configure-loki-for-alert-state) and [Prometheus](#configure-prometheus-for-alert-state-alerts-metric). Then, adjust your Grafana configuration as follows: + +```toml +[unified_alerting.state_history] +enabled = true +backend = multiple + +primary = loki +# URL of the Loki server. +loki_remote_url = http://localhost:3100 + +# Comma-separated list of secondary backends. +secondaries = annotations,prometheus +# Target data source UID for writing alert state changes. +prometheus_target_datasource_uid = + +[feature_toggles] +enable = alertingCentralAlertHistory ```