Kibana: Universal Alerting & Watcher

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 Watcher watch below was created and executed; Universal Alerting cannot run on 9.5.6 and was not exercised.

Most of this section teaches Kibana Classic Alerting: a rule type with a form, connectors and per-rule actions (Alerting Overview, Rules & Stack Rule Types). Elastic documents two other systems that detect conditions in Elasticsearch data and notify people: Universal Alerting, a newer design that writes every match as an append-only event and routes notifications through reusable policies, and Watcher, the JSON-defined engine that lives inside Elasticsearch itself and predates Kibana rules. This page explains how each works, what it costs you to adopt, and why Bookshelf’s lab alerts use Classic rules. The tool-neutral vocabulary (rule, alert, notification, state) is on Alerting Fundamentals.

The three systems and where they run

Elastic’s own comparison page lists the availability below. Read it before choosing, because two of the three systems are not available everywhere.

System Elastic Cloud Serverless Elastic Stack (self-managed, Cloud Hosted) Best for

Kibana Classic Alerting

Generally available

Generally available

Built-in rule types with form-based setup, no query language

Kibana Universal Alerting

Generally available

Planned (experimental in 9.5; the generally available version is documented from 9.6)

Control over detection and over notification routing, with queryable event history

Watcher

Unavailable

Generally available

Custom logic with scripting and chained inputs on self-managed Stack

The differences the comparison page draws are worth keeping in mind through the rest of the page. Classic Alerting updates a match in place, with limited query support; Universal Alerting stores append-only rule events that you can query with ES|QL in Discover; Watcher keeps a watch history index. Notifications are configured per action on each Classic rule, through action policies that trigger reusable workflows in Universal Alerting, and through action-level throttling and conditions in Watcher. Elastic Security detection rules are a fourth, separate system and are out of scope here.

The consequence for the Bookshelf lab, which runs Kibana 9.5.6 with a trial licence, is simple. Classic rules are the only generally available Kibana alerting system on that stack, so the lab’s five alerts use them. Universal Alerting examples below are written for Serverless or a Stack version from 9.6 on; Watcher examples run on the lab stack as written.

Universal Alerting

Universal Alerting is opened from Alerting in the Observability navigation menu. It is a separate system from Classic Alerting: its APIs and instructions do not interchange with Classic ones, and an Elasticsearch cluster can run both side by side. The documentation covers only the generally available version. Anyone who tried the experimental version in 9.5 should move to 9.6 or later, because the design changed significantly before general availability, so nothing on this page should be copied into a 9.5 cluster that has the experimental flag on.

The five building blocks

Two kinds of object are yours to create and two are generated by Kibana.

  • Rules describe what to look for (an ES|QL query) and how often to check.

  • Rule events are generated: every matching row of a run is written as a document in the .rule-events index, and an existing event is never overwritten.

  • Alerts are generated: Kibana groups the events that belong to one problem into an alert so you triage one lifecycle per problem.

  • Action policies decide whether and when an alert invokes a workflow. They are configured separately from rules, so you can change who is notified without touching what a rule detects.

  • Workflows do the work: post to Slack, send an e-mail, call a webhook, open a ticket.

Compare that with Classic Alerting, where the rule owns its actions. Here a single action policy can serve many rules, and several policies can react to the same alert independently.

What happens after a rule runs

A rule runs on a schedule and evaluates its ES|QL query. Each matching row becomes a rule event whose type is either alert or signal, depending on the rule’s mode. The two paths are very different.

flowchart LR R["ES|QL rule: schedule + lookback"] --> E[".rule-events: append-only"] E -->|"mode Detect and respond, type alert"| A["Alert: pending, active, recovering, inactive"] A --> D["Dispatcher: polls about every 5 s"] D --> P["Action policy: eligibility, scope, frequency"] P --> W["Workflow: webhook, Slack, e-mail"] E -->|"mode Collect evidence, type signal"| S["Discover, dashboards, follow-on rule"] U["User action: acknowledge, snooze, assign"] -->|"alert lifecycle trigger"| W
  • Alert path (type: alert). Alert events carry episode.* fields; events with the same episode.id belong to one alert. Kibana opens the alert in pending and moves it to active once the activation threshold is met. When the condition clears, Kibana writes a recovery event and the alert moves to recovering and then inactive.

  • Signal path (type: signal). The event stays in .rule-events. It does not appear on the Alerts page, no action policy or lifecycle trigger evaluates it, and it is queryable in Discover immediately.

A background process called the dispatcher polls about every five seconds and evaluates each alert against each policy, so at least one polling cycle passes between a rule run and a notification. Keep that in mind when you measure notification latency in the lab: the delay is not the rule’s schedule and not the webhook.

Rules: query, schedule, lookback and mode

A rule is created in one of four ways: the ES|QL rule form (a step-by-step form plus a YAML editor), the rule builder (pick a rule type, currently only Threshold Alert, and fill in structured inputs), Discover (convert a query you already have working), or the Elastic Agent Builder (an AI agent helps you write the rule). The settings of an ES|QL rule are:

Setting Meaning

ES|QL query (required)

The detection logic. The query needs no time filter: the sandbox and the rule apply one automatically.

Schedule (required) and lookback

How often the rule runs, and how far back each run’s query looks. Lookback is optional but strongly recommended.

Grouping

Tracks several subjects (hosts, services, users) as separate alert series inside one rule. In the form, the group fields are taken from the STATS ... BY clause.

Alert delay, recovery, no-data handling

Optional, and apply only when matches are grouped into an alert. Covered below.

Rule mode

Detect and respond (earlier Stack label Alert) or Collect evidence (earlier label Signal). The mode cannot be changed after the rule is saved; to switch, create a new rule or copy one.

Choose Collect evidence while tuning a query, when you want detection history, or when nobody should be paged; choose Detect and respond for production queries that need triage, escalation, notifications or duration tracking. A common pattern is to collect evidence first and later add a follow-on rule that reads .rule-events and opens alerts.

A Bookshelf rule

The lab’s "high 5xx ratio" alert (threshold 0.05 over five minutes) written as a Universal rule would use a query like the one below. The index pattern and the field names (service.name, http.response.status_code) are the ones used elsewhere in this section; use the names Discover shows for your EDOT data. Integer division in ES|QL truncates, so one operand is converted first.

FROM traces-*
| WHERE service.name == "bookshelf"
| STATS total = COUNT(*), errors = COUNT(*) WHERE http.response.status_code >= 500 BY service.name
| EVAL ratio = TO_DOUBLE(errors) / total
| WHERE ratio > 0.05

Create it with schedule 1 minute and lookback 5 minutes, mode Detect and respond, group field service.name, alert delay Breaches with two consecutive breaches, default recovery and Consecutive recoveries of 3. The tutorial in the documentation uses the same structure (a STATS ... BY query, a CASE expression for severity, schedule 5 minutes, lookback 45 minutes, two consecutive breaches, default recovery, immediate recovery delay) with synthetic checkout latency data.

Alert delay

Alert delay is the Universal counterpart of Classic’s alert delay and of Grafana’s pending period. It decides when a breached rule moves from pending to active. The Immediate mode opens an alert on the first breach; Breaches waits for a number of consecutive breaches; Duration waits for a time of continuous breach. Both can be combined with an operator.

state_transition:
  pending:
    count: 5
    timeframe: 2m
    operator: and

count is an integer from 0 to 1000 (the number of consecutive matches spent in pending, so 2 opens the alert on the third match), timeframe a duration from 5s to 365d, and operator is and or or, defaulting to or. Use the delay for metrics that fluctuate, such as CPU; leave it on Immediate when a single breach needs attention. For Bookshelf, the p95 latency rule benefits from a delay and the no-data rule does not.

Source: Alert delay.

Recovery and no data

Default recovery (no_breach) recovers when the group stops breaching; Custom recovery (condition) recovers when the base query plus a separate recovery condition returns the group, which gives hysteresis (alert above 90 percent CPU, recover below 70 percent); No recovery (manual) closes alerts only by hand, useful for security investigations. A query strategy with its own FROM clause exists but can be set only in YAML. The recovery delay mirrors the alert delay with state_transition.recovering (count 0 to 1000, timeframe 5s to 365d, operator defaulting to or) and cannot be set with No recovery. An empty query result triggers no-data handling for the default and custom strategies, and a Recover immediately no-data option closes the alert on the first no-data evaluation and bypasses the recovery delay.

Rule events and signals

Because events are append-only, .rule-events is a history you can query, chart and keep under lifecycle management. The fields the documentation describes are @timestamp, type (signal or alert), status, data (the payload of the matching row), rule.id and the episode.* fields on alert events. The status of a signal is always breached; for alert events it can also be recovered or no_data. A recent-signals query in Discover looks like this.

FROM .rule-events
| WHERE type == "signal"
| SORT @timestamp DESC
| KEEP @timestamp, rule.id, status, data
| LIMIT 100

The follow-on pattern turns that history into an alert: a first rule records, say, calls to a rarely used admin endpoint as signals; a second rule buckets those events in 15-minute windows, counts them and opens an alert only when the count passes a threshold. One query can also combine events from several rules, which Classic Alerting cannot do.

Action policies and workflows

An action policy is the gating layer between an alert and a workflow. A policy and a rule are linked when they share at least one routing tag; the link does not depend on the rule’s id, name or ordinary tags, and it applies to rules tagged after the policy was created. Kibana evaluates three gates in order, and a workflow runs only when an alert passes all of them.

  1. Eligibility: the alert is blocked if it is acknowledged, snoozed, resolved or inside a maintenance window.

  2. Policy scope: the rule shares a routing tag with the policy and the alert matches the policy’s KQL expression, if one is set. An empty scope matches every eligible alert in the space.

  3. Frequency: if a workflow already ran for the alert’s notification group within the policy’s frequency interval, the alert waits.

Each policy is checked independently, with no precedence and no merging: one policy blocking an alert does not stop another from invoking a workflow, and if no policy applies, no notification is sent. The most common first-time failure follows from that sentence. A rule without a matching policy fires, creates alerts, and nothing arrives at the webhook receiver. A severity change does not re-trigger a policy that already applied to the alert.

Workflows are started in two ways, and you can use both. Action policies evaluate continuously and suit recurring notifications and escalation. Alert lifecycle triggers (Preview on Serverless, Planned on Stack) start a workflow immediately when a person resolves, assigns, acknowledges or snoozes an alert, and emit named events such as alerting.actions.alertAssigned; they do not fire on automatic changes such as an alert becoming active or recovering. Using workflows requires the appropriate role privileges and a subscription that includes workflows. On the Stack, notifications require an Enterprise licence.

Setup and switches

Universal Alerting is on by default on Serverless and its availability on the Stack is Planned. Three switches matter: the global advanced setting alerting:v2:enabled (default on), the space-level alerting:v2:experimentalFeatures (default off; experimental features such as rule sequences may change or disappear), and alerting:v1:showV1ObservabilityAlertsTable (default off), which keeps the classic Alerts (Classic) page next to the new one. On the Stack the opt-out is xpack.alerting_v2.enabled: false in kibana.yml. Rules, policies and their privileges are scoped to a single space, so the bookshelf space of the lab would hold its own rules and policies, and notifications go out through connectors.

Labels for this page

  • Serverless only today: general availability, and Preview for alert lifecycle triggers.

  • Planned for the Stack: every Universal Alerting page labels the Stack as Planned; the 9.5 experimental version is not the documented one.

  • 9.6 and later: the version from which the documentation describes the generally available design.

Watcher

Watcher detects changes or anomalies in your data and acts on them. A watch is a single alert that can contain several notification actions, runs on a schedule, and is stored in Elasticsearch, not in Kibana saved objects. It is available on the Stack and not on Serverless. Kibana itself offers a Watcher management page under Stack Management; the books show it in version 8.

Source: Watcher.

Anatomy of a watch

Part Role

Trigger

When the watch is checked. Every watch needs one, for example a schedule interval.

Input

Loads data into the watch payload: an Elasticsearch search, an external HTTP service, or both. Without an input the payload is empty.

Condition

Decides whether the actions run. Defaults to always. Options are always, never, compare, array_compare and script (Painless).

Transform

Optional reshaping of the payload before the actions, at watch level or per action.

Actions

What happens when the condition is met: e-mail, webhook, index, logging, Slack, PagerDuty. Each action can have its own condition, transform and throttle period.

When a trigger fires, Watcher queues the watch, records a watch_record and runs the input, the condition (stopping if false), the transforms and the actions unless they are throttled. Throttling is on by default with a period of five seconds, per action or per watch. Acknowledging a watch stops notifications while the condition stays true; once the condition evaluates false the acknowledgement clears. Watches are active by default; an inactive watch is not registered with the trigger engine, though the execute API can still force a run. Scripts are Painless, templates are Mustache.

The history index

Every triggered run adds a document to the watch history, which stores the execution time, whether the condition was met, the input results and each action’s outcome. This is the evidence for "why did (or did not) this watch notify": search the history by execution time, or for runs where result.condition.met is true. Only the execute watch API with record_execution set to true writes a record for a manual run; the default is false.

A Bookshelf watch

The same 5xx ratio condition as a watch, on the lab’s trial licence. The input is a search that returns only aggregations; the condition guards against an empty window before dividing; the action posts to the webhook receiver that Kibana’s Classic connector also uses. Index names and fields are those of the earlier example.

PUT _watcher/watch/bookshelf-5xx-ratio
{
  "trigger": { "schedule": { "interval": "1m" } },
  "input": {
    "search": {
      "request": {
        "indices": [ "traces-*" ],
        "body": {
          "size": 0,
          "query": {
            "bool": { "filter": [
              { "term": { "service.name": "bookshelf" } },
              { "range": { "@timestamp": { "gte": "now-5m" } } }
            ] }
          },
          "aggs": {
            "total": { "filter": { "match_all": {} } },
            "errors": { "filter": { "range": { "http.response.status_code": { "gte": 500 } } } }
          }
        }
      }
    }
  },
  "condition": {
    "script": {
      "source": "def t = ctx.payload.aggregations.total.doc_count; return t > 0 && ctx.payload.aggregations.errors.doc_count / (double) t > 0.05;"
    }
  },
  "actions": {
    "notify_webhook": {
      "throttle_period": "10m",
      "webhook": {
        "scheme": "http",
        "host": "webhook-receiver",
        "port": 8080,
        "method": "post",
        "path": "/kibana",
        "headers": { "Content-Type": "application/json" },
        "body": "{\"watch\":\"{{ctx.watch_id}}\",\"errors\":{{ctx.payload.aggregations.errors.doc_count}},\"total\":{{ctx.payload.aggregations.total.doc_count}}}"
      }
    }
  }
}

Reference: Create or update a watch (POST or PUT /_watcher/watch/{id}, cluster privilege manage_watcher, query parameter active defaulting to true).

Test it without waiting for a trigger. The execute watch API (POST /_watcher/watch/{id}/_execute) accepts ignore_condition, record_execution, action_modes (simulate, force_simulate, execute, force_execute, skip), alternative_input to substitute a payload and an inline watch that is not persisted.

POST _watcher/watch/bookshelf-5xx-ratio/_execute
{
  "ignore_condition": true,
  "record_execution": true,
  "action_modes": { "notify_webhook": "force_simulate" }
}

Reference: Run a watch.

Managing watches

Besides searching the .watches index (it is read only, so create, update and delete through the Watcher APIs, and grant users read access only), the /_watcher/_query/watches API lists stored watch definitions as JSON so you can inspect them, migrate them between clusters, keep them in version control or export a filtered set. Deactivate and acknowledge have their own APIs. Back up watches with snapshot and restore, including the watcher feature state, which a snapshot includes by default. Create watches only through Kibana or the API, never by writing to .watches. If Security is enabled, a watch can search or index only what the storing user may access, and the HTTP input needs credentials too, ideally of a user with minimal privileges.

Source: Managing watches.

What can go wrong with Watcher

  • A watch lives in the cluster, so it is not in the Kibana space model: spaces and Kibana role scoping do not apply to it, only cluster privileges.

  • Watcher does not use Kibana connectors. The e-mail action needs an account configured under xpack.notification.email.account in elasticsearch.yml and a restart, which makes it a platform-team change, not a self-service one.

  • Throttling is time based; a long throttle hides a second incident that starts inside the period.

  • Watches are code in a JSON dialect and Painless; review them like code and keep them in version control.

  • There is no recovery notification unless you build a second watch or action for it.

When each is appropriate

Pick the system by the deployment and the job, not by habit.

Situation Choice

Monitor metrics, logs or uptime with ready-made rules, on any deployment

Classic Alerting. This is what the lab and most of this section use.

Serverless, or a Stack from 9.6 on, and you want detection written as ES|QL, queryable event history and reusable notification policies

Universal Alerting, after checking the labels above.

Self-managed Stack, highly customised logic with scripting and chained inputs that no rule type offers

Watcher, while accepting that it is outside Kibana’s spaces and connectors.

An existing estate of watches that works

Keep it, monitor it, and migrate when a watch needs a change that a Kibana rule can express.

The books on this topic describe Watcher as the Elastic alerting mechanism because, in their versions, it was. That is no longer a safe default: the Watcher page itself points readers to Kibana Alerting for built-in actions and integration with the Kibana applications. For new work, use Classic or Universal rules, and treat Watcher as a tool for the cases listed above.

Verify it in the lab

  1. Start the kibana profile and the load generator (see Hands-on Lab). In Dev Tools run the PUT _watcher/watch/bookshelf-5xx-ratio request above; the response must show "created": true.

  2. Run the _execute request with record_execution true. The response contains watch_record; check result.condition.met and that the webhook action is reported as simulated.

  3. Switch the load generator to failing-request mode, wait two minutes, then run GET .watcher-history*/_search with {"sort":[{"result.execution_time":"desc"}],"size":5}. The newest records must show result.condition.met true and the webhook receiver log must show a request to /kibana.

  4. Deactivate the watch with PUT _watcher/watch/bookshelf-5xx-ratio/_deactivate and check that no new history records appear; delete it afterwards so it does not keep running.

  5. Universal Alerting cannot be exercised on 9.5.6. On Serverless or Kibana 9.6 or later, create the rule of this page in mode Detect and respond, give it a routing tag, create an action policy with the same tag and a webhook workflow to http://webhook-receiver:8080/kibana, break Bookshelf, and observe pending, active and then inactive on the Alerts page. Remove the policy and confirm that the alert still appears but nothing is delivered.

In the books

Shah, Kibana 8.x, chapter 10, walks through creating a threshold watcher in the Watcher page under Stack Management (indices, time field, condition, an index action) and testing it; Paro, Elasticsearch 7.0 Cookbook, lists Watcher among the Kibana sections for registered queries. Both describe Watcher as the alerting tool. Neither covers Kibana rules and connectors as the primary path, nor Universal Alerting, whose rule events, action policies and workflows are far newer than the books. Publisher pages are listed in the bibliography of the section index.