Kibana: Observability Rules

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-09 against Kibana 9.5.x. Tested with Elasticsearch 9.5.6 and Kibana 9.5.6 in the hands-on lab (trial licence): the custom threshold, APM latency and no-data rule requests were accepted unchanged apart from the field names, each fired when the load generator broke the service and reached the receiver, and the burn rate rule ran on the lab SLO.

To do this by hand, follow Observability Rules and SLOs.

The Stack rule types of Rules & Stack Rule Types can alert on any Elasticsearch data, but they know nothing about services, hosts or error budgets. The Observability rules do: they understand APM services and transaction types, infrastructure inventory, log rates, SLOs and data quality, and they put their alerts on the Observability Alerts page. This page walks through them in the order a team adopts them, starting with the custom threshold rule, which is the general-purpose one and the replacement for the metric threshold rule, and ends with the five Bookshelf rules created through the API. The model they share (rule, alerts, actions, connectors) is on Alerting Overview.

The rule types at a glance

The Observability documentation lists these rule types, with the API rule_type_id that rules-as-code needs.

Rule type rule_type_id Detects when

Custom threshold

observability.rules.custom_threshold

An Observability data type reaches or exceeds a value; the general rule

Inventory

metrics.alert.inventory.threshold

A metric of hosts, pods, containers or cloud resources exceeds a threshold

Log threshold

logs.alert.document.count

The count or ratio of log entries matching conditions meets a threshold

Metric threshold

metrics.alert.threshold

A metric reaches a threshold (deprecated since 9.4; use custom threshold)

APM latency threshold

apm.transaction_duration

Latency of a transaction type exceeds a threshold

APM error count threshold

apm.error_rate

Errors in a service exceed a threshold

APM failed transaction rate threshold

apm.transaction_error_rate

The share of failed transactions exceeds a threshold

APM anomaly

apm.anomaly

Latency, throughput or failed transaction rate is abnormal

SLO burn rate

slo.rules.burnRate

The error budget burns faster than a threshold in a long and a short window

Degraded docs

datasetQuality.degradedDocs

The percentage of degraded documents in a data view exceeds a threshold

Anomaly detection

xpack.ml.anomaly_detection_alert

Anomalies of machine learning jobs match conditions

Source: Create and manage rules for Elastic Observability. The rule type ids come from the Create a rule API reference, and GET /s/bookshelf/api/alerting/rule_types lists what your Kibana offers.

Shared facts worth knowing before the details:

  • Observability rules are generally available on Serverless and on the Stack; the rule type table of the Observability alerting page carries no per-type availability. Anomaly detection and Stack Management alerts have been shown on the Observability Alerts page since 9.5 for users with the matching feature privileges.

  • Creating a rule needs all on the Observability feature of the rule type (APM, Logs, Infrastructure, Synthetics); anomaly detection rules also need Machine Learning privileges; on Serverless the Editor role or higher.

  • Rules can be created from the Rules page or from the app: the APM Alerts and rules menu, the Infrastructure Alerts menu, the More actions menu of an SLO or the Data Set Quality page. Created from there, name, tags and scope fields come pre-filled.

  • The inventory, log threshold, metric threshold and APM rules read the index patterns from the Kibana advanced setting observability:logSources or from the Infrastructure settings (metrics defaults metrics-* and metricbeat-*, logs defaults logs-*-*, logs-* and filebeat-*) and cannot override them per rule; the custom threshold rule uses a data view you choose.

  • Most of the rule-specific action variables are shared: {{context.reason}} (a short description), {{context.viewInAppUrl}} (link to the alert source) and {{context.alertDetailsUrl}} (link to the alert troubleshooting view, which is empty unless server.publicBaseUrl is set, one of the settings that Installation & Configuration sets in the lab). {{context.grouping}} exposes the groups of a grouped rule (since 9.1 for most rules and since 9.2 for inventory, log threshold and metric threshold).

The custom threshold rule

The custom threshold rule alerts on any Observability data type: metrics, logs, traces or business data, as long as a data view points at it. It replaces the older metric and log rules for new work, and it is the rule that the Elastic documentation recommends for alerting on OpenTelemetry and Prometheus remote write metrics on every deployment type. It is built from four pieces.

Data. Select an existing data view (or Create a data view) and optionally add a query filter in KQL that narrows everything the rule sees, for example host.name:host-1.

Aggregations. Each aggregation gets a letter (A, B, C in the documentation’s examples; the page states no maximum). The types are Average, Max, Min, Cardinality, Count, Sum, Percentile and Rate. Count uses the document count and needs only an optional KQL filter; the others need a field. Since 9.4 on the Stack every aggregation can carry its own KQL filter, which is what makes a ratio of two different subsets of the same data possible in one rule.

Equation and threshold. The equation combines the letters: basic arithmetic ((A + B) / C * 100) or boolean logic (A == B ? 1 : 0). The condition compares the result with a threshold using is above or is below (and other comparators in the UI). The preview chart shows the matching entries and shades the threshold; with Group alerts by it shows only the top three groups.

Warning threshold. Add warning threshold (Stack since 9.5, Serverless) gives the rule two severities: crossing the warning threshold runs the Warning action group and crossing the critical one the Alert action group. The severity values are warning and critical, which per-alert snooze can use as a condition (snooze until the severity changes).

Group alerts by. A composite aggregation on one or more fields creates one alert per group (multiple fields give names like Host A, Architecture A).

No data. Since 9.4 (and on Serverless) three behaviours are offered:

Option Behaviour

Recover active alerts

Active alerts recover when data is missing; no new alert is created

Alert me about the missing data

With Group alerts by: alert when a group seen before stops reporting (not recommended for dynamically scaling infrastructure). Without it: alert when no data is returned during a run, or when the rule fails to query Elasticsearch

Do nothing

Active alerts stay as they are and no new alert is created

On 9.0 to 9.3 the older single option Alert me if there’s no data applies; with group fields, if a group that stopped reporting comes back above the threshold, the existing alert turns into a threshold breach without a new notification. For decommissioned hosts, More actions, Mark as untracked in the Alerts table ends their alerts.

Actions. The Run when groups are Alert, Warning (Stack 9.5 and Serverless), No Data and Recovered. Rule-specific variables: context.alertDetailsUrl, context.cloud, context.container, context.group, context.grouping, context.host, context.labels, context.orchestrator, context.reason, context.tags, context.timestamp, context.value and context.viewInAppUrl. The role-visibility scope (All by default since 9.3, Logs, Metrics, Stack Management) decides which Kibana privileges can see the rule. Suggested dashboards on an alert are available only for custom threshold rules.

The documentation’s examples show the range: a count with the filter log.level: "warn" above 100; a failure ratio (A = count where http.response.status_code: 500, B = count, equation A / B * 100, above 5); CPU (A = average system.cpu.user.pct, B = average system.cpu.system.pct, C = max system.cpu.cores, equation (A + B) / C * 100, above 95, with a warning at 80); and a Kubernetes stateful-set check (sum of ready replicas equal to the sum of desired replicas, A == B ? 1 : 0, below 1).

The metric threshold rule and its equivalent

The metric threshold rule is deprecated on the Stack since 9.4 (generally available 9.0 to 9.3, not available on Serverless), as the tag on the Metrics Explorer page states; the rule’s own page still describes it normally and carries no deprecation notice, so existing rules keep working. New alerts should use the custom threshold rule. The mapping:

Metric threshold rule Custom threshold rule

Aggregation and metric per condition

One aggregation (Average, Max, …​) with a field per letter; ratios between metrics become an equation

Warning and critical thresholds (Stack 9.5)

Warning threshold on the criterion (Stack 9.5)

Filter (KQL only)

Query filter on the data view, plus a KQL filter per aggregation since 9.4

Group alerts by

Group alerts by

No-data options (9.1 and later): recover, alert, do nothing

The same three options since 9.4

Metrics indices from the Infrastructure settings

Any data view, including metrics-*.otel-*

Consecutive runs (default 1)

Consecutive runs (default 1) in the advanced options

For example, the metric threshold condition "average system.cpu.total.norm.pct is above 0.9 with a warning at 0.8" becomes a custom threshold with one aggregation A (Average of system.cpu.total.norm.pct), the equation A, the threshold is above 0.9 and the warning threshold 0.8. Sources: Create a metric threshold rule and the deprecation tag on Explore metrics.

Inventory rule

The inventory rule alerts when a metric of infrastructure resources crosses a threshold, using the settings you already have in the Infrastructure inventory: open Observability, Infrastructure, then Alerts, Infrastructure, Create inventory rule, and the rule inherits the inventory’s parameters. The inventory types are Hosts, Kubernetes Pods, Docker Containers and AWS. Each condition is an aggregation and a metric, with an optional warning threshold, and a rule can combine several conditions to reduce false positives (the documentation’s example: critical for pods in the ingress-nginx namespace at 95 percent memory or more, warning at 90). For the last is the look-back window and the chart previews twenty times that window. You can be notified when no data is returned for a metric and when the rule fails to query Elasticsearch. The Schema dropdown (since 9.2) targets OpenTelemetry or the Elastic System integration for Hosts and Kubernetes Pods (on the Stack, Kubernetes Pods schema selection is planned); Docker Containers and AWS have no schema choice. The Run-when groups are Alert, Warning and Recovered, and the variables add context.metric, context.threshold and context.value per condition (condition0, condition1) and, in recovery messages only, context.originalAlertState and its WasALERT and WasWARNING flags. After upgrading to 9.6, review Kubernetes Pods rules saved with the OpenTelemetry schema before 9.6: they were evaluated against Kubernetes integration data, and from 9.6 they use OpenTelemetry data.

Source: Create an inventory rule. The metrics behind each inventory type are described on Infrastructure & Host Monitoring.

Log threshold rule

The log threshold rule fires when the number of log messages matching conditions exceeds a threshold in a time window. A count criterion has fields and comparators: numeric fields use more than, more than or equals, less than, less than or equals (Elasticsearch range); aggregatable fields use is and is not (term); non-aggregatable fields use matches (any of the words in any order) and matches phrase (the exact phrase), each with its negation. A ratio rule divides the count of query A by the count of query B (for example, twice as many errors as warnings); when either count is zero the ratio is undefined and no alert fires. Group by uses a composite aggregation and alerts per group; for performance use the more than comparator (eager filtering) or group by the field with the lowest cardinality. A group that has no documents in the window cannot be identified, so a "less than five" condition does not alert for a host that stopped reporting entirely: for silence, use the custom threshold no-data options. The action groups are Fired and Recovered, and the rule-specific variables are context.interval, context.threshold, context.triggerValue, context.grouping (since 9.2) and the shared ones. The Stack requires the Infrastructure application privilege; the page’s Serverless label is inconsistent, so check the rule list of your project.

APM rules

Four rule types watch APM data, created from the Applications UI (Alerts and rules) or the Rules page; all are generally available on the Stack and Serverless except where noted. They share a pattern: a scope (service, transaction type, environment, transaction name, or ALL, or a KQL filter instead), a threshold, a window, Group alerts by (the examples group by service.name and service.environment) and a check interval.

Rule Settings Defaults and indices

Latency threshold (apm.transaction_duration)

Aggregation Average, 95th percentile or 99th percentile; Is above in milliseconds; For the last window

Threshold 1500 ms, window 5 minutes, scope ALL

Error count threshold (apm.error_rate)

Service, environment, error grouping key (or ALL); Is above an error count; window

Threshold 25, window 5 minutes; indices logs-apm*, apm-*, logs-*.otel-*

Failed transaction rate threshold (apm.transaction_error_rate)

Service, type, environment, name; Is above a percentage; window

Failure rate 30 percent, window 5 minutes; indices metrics-apm*, apm-*, metrics-*.otel-* (or transaction indices when aggregated search is off)

APM anomaly (apm.anomaly)

Service, type, environment; detector types Latency, Throughput, Failed transaction rate, Low transaction count; minimum severity warning, minor, major or critical

Needs the APM machine learning jobs; the low-count detector needs a job that includes low_count

The action variables are context.serviceName, context.transactionType, context.transactionName, context.threshold, context.triggerValue, context.interval, context.reason, context.viewInAppUrl, context.alertDetailsUrl and, since 9.1, context.grouping; the error count rule adds context.errorGroupingKey and context.errorGroupingName. The documentation describes context.environment as the transaction type, so print it once in a test action and check what it contains before using it in a message. The groups are "threshold met" and "recovered" in the documentation’s wording; read the exact ids from the rule types endpoint.

The anomaly rule is generally available on the Stack through Alerts, Manage Rules in 9.0 to 9.5; the Create anomaly rule shortcut from the Applications pages and the low transaction count detector are generally available on Serverless and planned for the Stack (the shortcut arrives in 9.6+). Alerting on machine learning more broadly is on Machine Learning & AIOps, and the services themselves on APM & Synthetics.

SLO burn rate rule

The SLO burn rate rule is the alert half of an SLO (the SLO itself is on SLOs). With target and an observed error ratio in a window, the burn rate is ; the rule alerts when the burn rate is above a threshold in both a long and a short window. The long window is the Lookback (hours) value, and the short window is one twelfth of it (a one-hour long window pairs with a five-minute short one), so the alert fires fast when the problem is real and resets fast when it ends. Each burn rate window also has an action group that acts as severity (critical, high, medium or low), so a rule carries several windows. New rules start with four windows; the Bookshelf SLO of SLOs uses the windows of the Site Reliability Workbook:

Severity Long window Short window Burn rate threshold Equals an error ratio of (target 99.5 percent)

Critical

1 hour

5 minutes

14.4

0.072

High

6 hours

30 minutes

6

0.03

Medium

24 hours

2 hours

3

0.015

Low

72 hours

6 hours

1

0.005

Creating an SLO in the UI creates a default burn rate rule with default settings and no connector, so nothing is notified until you edit it and add an action; rules can also be created from the SLO’s More actions, Create new alert rule. Rule-specific variables are context.sloId, context.sloInstanceId, context.sloName, context.burnRateThreshold, context.longWindow, context.shortWindow, context.reason, context.timestamp, context.viewInAppUrl, context.alertDetailsUrl and, since 9.1, context.grouping. The rule reads .slo-observability.sli* and .slo-observability.summary*, which cannot be overridden, and on the Stack needs a suitable licence, an Elasticsearch cluster with transform and ingest nodes and configured SLO access. The API also accepts an optional maxBurnRateThreshold per window and a dependencies list.

Source: Create an SLO burn rate rule. The alerting design behind multiwindow burn rates is on SLIs, SLOs & Error Budgets; the Grafana version is on Grafana: SLOs & IRM.

Degraded docs rule

The degraded docs rule is based on the Data Set Quality page: it alerts when the percentage of degraded documents in a data view exceeds a threshold for a time period (documents that Elasticsearch accepted but ignored fields of, for instance because of mapping limits; the page defines them no further). Create it from the Rules page (Degraded docs) or from a data set in Data Set Quality, Actions, Create rule, which fills in the data view. The settings are the data view, the threshold percentage, the time period that the threshold must be exceeded, Group alerts by, the schedule, and the advanced Alert delay and Flapping detection. The Run-when groups are Alert, No Data and Recovered, and the variables include context.value (list of condition values), context.group and the shared ones. It needs the Data Set Quality role with the Manage rules privilege or the Editor role, and is generally available on the Stack since 9.1 and on Serverless. For Bookshelf it protects the EDOT data streams: a collector or mapping change that suddenly degrades logs-generic.otel-default shows up here before it shows up as missing fields in a dashboard (Data Streams, TSDS & Lifecycle).

Stack Monitoring rules

Stack Monitoring alerts on the health of the Elastic Stack itself and is not an Observability rule family, but it belongs in the same inventory of "what is alerting for me". The first time you open Stack Monitoring Kibana asks whether to create the default rules (later: Alerts and rules, Create default rules). They are not managed through Saved Objects.

Rule (rule_type_id) Default condition Check Re-notify

CPU usage (monitoring_alert_cpu_usage)

Average at or above 85 percent over 5 minutes

1 min

1 day

Disk usage (monitoring_alert_disk_usage)

Average at or above 80 percent over 5 minutes

1 min

1 day

JVM memory (monitoring_alert_jvm_memory_usage)

Average at or above 85 percent over 5 minutes

1 min

1 day

Missing monitoring data (monitoring_alert_missing_monitoring_data)

Missing for 15 minutes, look back one day

1 min

6 hours

Thread pool rejections (monitoring_alert_thread_pool_search_rejections, monitoring_alert_thread_pool_write_rejections)

At least 300 over 5 minutes, search and write set separately

1 min

1 day

CCR read exceptions (monitoring_ccr_read_exceptions)

At least 1 in the last hour

1 min

6 hours

Large shard size (monitoring_shard_size)

Average shard size at or above 55 GB over 5 minutes

1 min

12 hours

Cluster rules also cover cluster health turning yellow or red, Elasticsearch, Kibana and Logstash version mismatches, nodes added or removed, and licence expiry. By default the actions only write to the Kibana log and show a notification in the UI; external notification needs a connector added to the rule’s Actions (the legacy Watcher e-mail setting no longer works). More on Stack Monitoring & AutoOps.

The Bookshelf rules

The five alerts of the lab, with the lab’s canonical numbers (5xx ratio above 0.05, p95 latency above 0.5 s, 20 error lines) in the bookshelf space, tagged bookshelf and bookshelf-sre, all sending to the connector bookshelf-webhook that posts to http://webhook-receiver:8080/kibana (created on Rules & Stack Rule Types). Field names follow the lab data views (bookshelf-traces, bookshelf-logs); use the field names Discover shows if your OpenTelemetry mappings differ.

Alert Rule Notes

High 5xx ratio

Custom threshold: A = count where http.response.status_code >= 500, B = count, equation A / B, above 0.05, window 5 minutes

Use the ratio, not a count, so the rule is traffic independent; ratio as a fraction (0.05), not a percentage

p95 latency above SLO

APM latency threshold: service bookshelf, type request, environment lab, 95th percentile above 500 ms, window 5 minutes

One threshold, same value as the 500 ms of the latency SLO

No data

Custom threshold: A = count of service.name: "bookshelf", below 1, with Alert me about the missing data

Catches a silent collector as well as a stopped service

Error-log spike

Custom threshold: A = count where the log level is ERROR, above 20, window 5 minutes (the Elasticsearch query rule is an alternative)

Count over the logs data view

SLO burn rate

Burn rate rule on the availability SLO, the windows of the table above

Needs the SLO to exist first

The calls below use two small helpers that read the action group ids from the rule types endpoint rather than guessing them. jq is required.

export KIBANA_URL=http://localhost:5601
types() { curl -s -u elastic:"$ELASTIC_PASSWORD" "$KIBANA_URL/s/bookshelf/api/alerting/rule_types"; }
default_group() { types | jq -r --arg t "$1" '.[] | select(.id == $t) | .default_action_group_id'; }
group_named()   { types | jq -r --arg t "$1" --arg n "$2" '.[] | select(.id == $t) | .action_groups[] | select(.name | ascii_downcase == $n) | .id'; }

High 5xx ratio. Two count aggregations with different filters, one equation:

CT=observability.rules.custom_threshold
curl -s -u elastic:"$ELASTIC_PASSWORD" -X POST "$KIBANA_URL/s/bookshelf/api/alerting/rule/bookshelf-5xx-ratio" \
  -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d @- <<JSON
{
  "name": "Bookshelf high 5xx ratio",
  "rule_type_id": "$CT",
  "consumer": "alerts",
  "tags": ["bookshelf", "bookshelf-sre"],
  "schedule": { "interval": "1m" },
  "params": {
    "criteria": [
      {
        "aggType": "custom",
        "comparator": ">",
        "threshold": [0.05],
        "timeSize": 5,
        "timeUnit": "m",
        "equation": "A / B",
        "label": "5xx ratio",
        "metrics": [
          { "name": "A", "aggType": "count", "filter": "service.name: \"bookshelf\" and http.response.status_code >= 500" },
          { "name": "B", "aggType": "count", "filter": "service.name: \"bookshelf\"" }
        ]
      }
    ],
    "searchConfiguration": { "index": "bookshelf-traces", "query": { "language": "kuery", "query": "" } },
    "alertOnNoData": false,
    "alertOnGroupDisappear": false
  },
  "actions": [
    {
      "id": "bookshelf-webhook",
      "group": "$(group_named $CT alert)",
      "frequency": { "summary": false, "notify_when": "onActionGroupChange", "throttle": null },
      "params": { "body": "{\"rule\":\"{{rule.name}}\",\"reason\":\"{{context.reason}}\",\"url\":\"{{context.viewInAppUrl}}\"}" }
    }
  ]
}
JSON

Reference: Create a rule (request schema for observability.rules.custom_threshold). A warning threshold adds "warningComparator": ">" and "warningThreshold": [0.02] to the criterion and a second action for the Warning group; the reason text is free text, so a receiver that parses the body as JSON should tolerate quotes in it. The free-text caveat and payload design are on Actions, Frequency & Action Variables.

p95 latency above SLO. The APM latency rule takes the threshold in milliseconds, so the lab’s 0.5 s is 500:

APM=apm.transaction_duration
curl -s -u elastic:"$ELASTIC_PASSWORD" -X POST "$KIBANA_URL/s/bookshelf/api/alerting/rule/bookshelf-p95-latency" \
  -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d @- <<JSON
{
  "name": "Bookshelf p95 latency above SLO",
  "rule_type_id": "$APM",
  "consumer": "apm",
  "tags": ["bookshelf", "bookshelf-sre"],
  "schedule": { "interval": "1m" },
  "params": {
    "serviceName": "bookshelf",
    "transactionType": "request",
    "environment": "lab",
    "aggregationType": "95th",
    "threshold": 500,
    "windowSize": 5,
    "windowUnit": "m",
    "groupBy": ["service.name", "service.environment"]
  },
  "actions": [
    {
      "id": "bookshelf-webhook",
      "group": "$(default_group $APM)",
      "frequency": { "summary": false, "notify_when": "onActionGroupChange", "throttle": null },
      "params": { "body": "{\"rule\":\"{{rule.name}}\",\"service\":\"{{context.serviceName}}\",\"value\":\"{{context.triggerValue}}\",\"threshold\":\"{{context.threshold}}\"}" }
    }
  ]
}
JSON

Reference: Create a latency threshold rule and the apm.transaction_duration schema of the Create a rule API reference (above).

No data. A count below one with the no-data behaviour set to alert:

curl -s -u elastic:"$ELASTIC_PASSWORD" -X POST "$KIBANA_URL/s/bookshelf/api/alerting/rule/bookshelf-no-data" \
  -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d @- <<JSON
{
  "name": "Bookshelf no data",
  "rule_type_id": "$CT",
  "consumer": "alerts",
  "tags": ["bookshelf", "bookshelf-sre"],
  "schedule": { "interval": "1m" },
  "params": {
    "criteria": [
      {
        "aggType": "custom",
        "comparator": "<",
        "threshold": [1],
        "timeSize": 5,
        "timeUnit": "m",
        "equation": "A",
        "label": "requests",
        "metrics": [ { "name": "A", "aggType": "count", "filter": "service.name: \"bookshelf\"" } ]
      }
    ],
    "searchConfiguration": { "index": "bookshelf-traces", "query": { "language": "kuery", "query": "" } },
    "noDataBehavior": "alertOnNoData"
  },
  "actions": [
    {
      "id": "bookshelf-webhook",
      "group": "$(group_named $CT 'no data')",
      "frequency": { "summary": false, "notify_when": "onActionGroupChange", "throttle": null },
      "params": { "body": "{\"rule\":\"{{rule.name}}\",\"reason\":\"{{context.reason}}\"}" }
    },
    {
      "id": "bookshelf-webhook",
      "group": "$(group_named $CT alert)",
      "frequency": { "summary": false, "notify_when": "onActionGroupChange", "throttle": null },
      "params": { "body": "{\"rule\":\"{{rule.name}}\",\"reason\":\"{{context.reason}}\"}" }
    }
  ]
}
JSON

Reference: Create a custom threshold rule, section on no data, and the noDataBehavior values recover, remainActive and alertOnNoData of the API schema. Two different situations can end in a notification here: zero matching documents, which a count evaluates to a value of 0 that the threshold below 1 catches, and a run that returns no data at all or fails to query, which the no-data option catches. Which one fires after you stop the collector is checked in the lab section below, and it is visible in context.reason. On the 9.5.6 lab, with the Bookshelf containers stopped, the no-data behaviour fired (the custom_threshold.nodata group, context.reason "requests reported no data in the last 5m") 5 min 25 s after the stop, when the 5 minute window had emptied.

Error-log spike. The same custom threshold rule with one count aggregation on the bookshelf-logs data view, filter severity_text: "ERROR" (the level field of OTLP logs), is above 20 over five minutes; the Elasticsearch query rule version of the same alert is on Rules & Stack Rule Types.

SLO burn rate. Create the availability SLO first (the SLO page shows the request), keep its id in SLO_ID, and create one rule with the four windows. The window ids are free strings; the long and short windows follow the one-twelfth rule:

BR=slo.rules.burnRate
curl -s -u elastic:"$ELASTIC_PASSWORD" -X POST "$KIBANA_URL/s/bookshelf/api/alerting/rule/bookshelf-slo-burn-rate" \
  -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d @- <<JSON
{
  "name": "Bookshelf SLO burn rate",
  "rule_type_id": "$BR",
  "consumer": "slo",
  "tags": ["bookshelf", "bookshelf-sre"],
  "schedule": { "interval": "1m" },
  "params": {
    "sloId": "$SLO_ID",
    "windows": [
      { "id": "w-critical", "burnRateThreshold": 14.4, "longWindow": { "value": 1,  "unit": "h" }, "shortWindow": { "value": 5,   "unit": "m" }, "actionGroup": "$(group_named $BR critical)" },
      { "id": "w-high",     "burnRateThreshold": 6,    "longWindow": { "value": 6,  "unit": "h" }, "shortWindow": { "value": 30,  "unit": "m" }, "actionGroup": "$(group_named $BR high)" },
      { "id": "w-medium",   "burnRateThreshold": 3,    "longWindow": { "value": 24, "unit": "h" }, "shortWindow": { "value": 120, "unit": "m" }, "actionGroup": "$(group_named $BR medium)" },
      { "id": "w-low",      "burnRateThreshold": 1,    "longWindow": { "value": 72, "unit": "h" }, "shortWindow": { "value": 360, "unit": "m" }, "actionGroup": "$(group_named $BR low)" }
    ]
  },
  "actions": [
    {
      "id": "bookshelf-webhook",
      "group": "$(group_named $BR critical)",
      "frequency": { "summary": false, "notify_when": "onActionGroupChange", "throttle": null },
      "params": { "body": "{\"rule\":\"{{rule.name}}\",\"slo\":\"{{context.sloName}}\",\"reason\":\"{{context.reason}}\"}" }
    }
  ]
}
JSON

Reference: Create an SLO burn rate rule and the slo.rules.burnRate schema of the Create a rule API reference. The consumer is the feature that owns the rule type (slo here, apm for the APM rule and alerts for the custom threshold rule with the default All scope; the producer field of the rule types output shows it); the example sends only the critical group to the webhook, and the other severities are visible on the Alerts page until tickets or chat actions are added on the actions page. If the SLO UI already created a default rule for the SLO, edit that rule instead of creating a second one.

What can go wrong

  • A ratio rule with an equation but one filter: the denominator needs its own aggregation (B) so that the ratio is over the right population; with a single filter the equation divides by the wrong thing.

  • Percent versus fraction: the lab uses 0.05 for a ratio computed as A / B; if you multiply by 100 in the equation the threshold is 5.

  • Group-based no data on auto-scaling infrastructure: every scale-in looks like a vanished group and alerts; use Recover active alerts or Do nothing there.

  • Missing links in notifications: context.alertDetailsUrl is empty unless server.publicBaseUrl is configured.

  • Metric threshold rules still existing: deprecated on 9.4 and later, unavailable on Serverless; plan the migration to custom threshold.

  • Inventory and log rules reading the wrong indices: they use the advanced and Infrastructure settings, not a per-rule choice, so a data stream outside those patterns is invisible to them.

  • A burn rate rule that never notifies: the SLO UI creates it without a connector.

  • The burn rate rule that silently shows no data: the SLO transforms are stopped or unhealthy (see the transform health rule).

  • API errors that mention an action group: the ids are per rule type; read them with the helpers above.

  • Rule edits by the wrong user change the privileges of the rule’s API key, as described on the rules page.

Verify it in the lab

  1. Create the connector and the rules above in the bookshelf space, then list them: curl -s -u elastic:"$ELASTIC_PASSWORD" "$KIBANA_URL/s/bookshelf/api/alerting/rules/_find?per_page=20&search=bookshelf&search_fields=name". Each should show last_run.outcome succeeded after a minute.

  2. Start the load generator in failing-request mode. After a few minutes the 5xx ratio alert becomes active; open it from the Alerts page, read the reason text and follow View in app. The receiver should get one call (docker compose logs webhook-receiver).

  3. Switch the load generator to slow mode: the latency alert becomes active when the 95th percentile of bookshelf transactions passes 500 ms for five minutes.

  4. Stop the edot-collector container. The no-data rule should alert within the five-minute window; note whether context.reason mentions missing data or a value of zero, and start the collector again to see the alert recover.

  5. Create the availability SLO, then the burn rate rule, and break Bookshelf completely: the critical window (1 hour at 14.4) fires after roughly five to ten minutes of a full outage (a full outage burns at 200 times for a 99.5 percent target, so the one-hour window crosses 14.4 after about four minutes, plus the check interval and the SLO transform’s latency).

  6. Change the 5xx rule to the metric threshold equivalent only to compare; delete it afterwards, since the rule type is deprecated.

In the books

Hausenblas’s Cloud Observability in Action (Manning, 2023) introduces error budgets and the burn rate, the quantity that the burn rate rule above evaluates; its treatment is vendor neutral and predates the Elastic rule types described here. Shah’s Kibana 8.x: A Quick Start Guide to Data Analysis (Packt, 2024) shows only the anomaly detection rule; the custom threshold rule, per-aggregation filters, the warning threshold, the unified Rules list and the deprecation of the metric threshold rule all arrived or changed after the 8.x screens it uses.

Where to go next