Kibana: Alerting Setup, Security & Scaling
|
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 alerting health, Task Manager health and event log requests of this page ran.
A rule that is configured perfectly but never runs is worse than no rule, because it looks like silence means health. Alerting in Kibana is not a feature that is simply on: it needs a key to encrypt connector credentials, a base URL for links, an Elasticsearch setting that its queries rely on, and an API key per rule that decides what the rule is allowed to read. It then runs on a general-purpose job scheduler (Task Manager) that shares the Kibana process with the user interface and that you must size, limit and watch. This page is the operator’s view: setup, security model, capacity, guardrails and how to check that the alerting machinery itself is healthy. The rule and connector content is on Rules & Stack Rule Types, Observability Rules and Connectors; monitoring the Elastic Stack itself is on Stack Monitoring & AutoOps. The Grafana counterpart is Grafana: Alerting HA & Operations.
Prerequisites for a self-managed stack
Three settings must be right before the first rule is saved. On Elastic Cloud and Serverless they are provided.
| Setting | Why |
|---|---|
|
A key of at least 32 characters that encrypts the sensitive properties of rules and connectors (passwords, tokens, webhook secrets). Without it Kibana generates a random key at start, and alerting and actions are blocked. Store it in the Kibana keystore rather than in the file, and use the same key on every Kibana instance of the deployment. |
|
The address users reach Kibana at. It feeds |
|
Must be |
If security is enabled the Elasticsearch API key service must not have been disabled, because every rule needs a key (below). The
Elasticsearch connection should use TLS: the alerting health endpoint is documented to report is_sufficiently_secure: false when security is on and
TLS is not (the lab, with TLS off, reported true). For mission-critical use the page points to the production considerations covered under Scaling below.
Source: Alerting setup, Alerting settings (the key, 32 or more characters, stored in the keystore).
In the Bookshelf lab the compose file of
Installation & Configuration already sets the key through
the environment (KIBANA_SAVED_OBJECTS_KEY) and SERVER_PUBLICBASEURL=http://localhost:5601. On a host install:
bin/kibana-keystore add xpack.encryptedSavedObjects.encryptionKey # paste a random 32+ character string
curl -s -u elastic:"$ELASTIC_PASSWORD" \
"http://localhost:9200/_cluster/settings?include_defaults=true&filter_path=*.search.allow_expensive_queries"
Reference: Elasticsearch API: Get cluster settings.
Check the framework: the alerting health API
GET /api/alerting/_health reports whether the framework itself is usable. It returns three substates, each with a status of ok,
warn or error and a timestamp: decryption_health (can rules be decrypted, which fails typically when the encryption key
differs from the one the rules were saved with), execution_health (rule runs) and read_health (reading events). It also returns
has_permanent_encryption_key (false means no key is configured and Kibana is using a generated one) and is_sufficiently_secure
(false means security is enabled but TLS is not). The endpoint needs the same authentication as the rest of the Kibana API and
exists per space path as well.
curl -s -u alice:change-me-lab-only "http://localhost:5601/s/bookshelf/api/alerting/_health"
Reference: Kibana API: Get the alerting framework health.
Privileges: who can do what
Alerting uses three Stack Management features and a few extras. The summary of the documentation:
-
Manage everything:
allfor Management > Stack Rules, Management > Rules Settings and Management > Actions and Connectors.readon Actions and Connectors is enough to add actions to a rule and to test a connector; the Cases connector also needsallon Cases. -
View only:
readon the same three features. -
Triage without managing rules (Stack 9.5 and later): Management > Stack Alerts and Observability > Observability Alerts, at
allorread, allow snoozing, unsnoozing and acknowledging alerts but not creating, editing, enabling, disabling or deleting rules. Viewing rule statistics or rule details still needs read access to the rules. -
Alerts in Discover or dashboards: the
readindex privilege on.alerts-*. -
Per rule type: machine learning rules need
allon Analytics > Machine Learning; Stack Monitoring rules need themonitoring_userrole; most Observability rules needallon the relevant Observability features, whereas custom threshold rules need only the Stack Alerts privilege. -
Revoke: set the three Stack Management features to
noneand remove the index privilege on.alerts-*.
These are explained with role definitions on
Spaces, Roles & Privileges. Rules and connectors belong to
the space in which they are created and are not visible from other spaces, so a connector used in the bookshelf space has to be
created in it.
Source: Alerting setup (sections on privileges and space isolation). Rules can query remote clusters with cross-cluster search on the Stack (not on Serverless), which needs privileges configured for both cross-cluster search and Kibana; cross-project search is the Serverless equivalent.
The API key every rule runs with
A rule runs in the background, without a user at the keyboard, so it needs credentials. Kibana creates an API key when the rule is created and refreshes it on every edit, capturing the privileges of the user who made the change. Serverless creates an Elastic Cloud API key from the roles of the saving user in the same way. The consequences are the heart of alerting security:
-
The rule runs with the privileges of the last editor. If someone with fewer privileges (say, without read access to
logs-*) edits a rule that needs more, the rule stops finding data and its condition can no longer be met; if someone with more privileges edits it, the rule silently runs with the larger privileges. -
Disabled rules keep their key. If the key is missing when the rule is enabled again, a new one is generated. Imported rules arrive disabled and get a new key when enabled.
-
Updating the key is Update API key in Stack Management > Rules or on the rule details page, or the API call below.
-
API-managed rules are created with either an API key or username and password authentication; in both cases the key stored with the rule is associated with the rule.
curl -s -X POST "http://localhost:5601/s/bookshelf/api/alerting/rule/bookshelf-5xx-ratio/_update_api_key" \
-u alice:change-me-lab-only -H "kbn-xsrf: true"
The operational rule that follows is to own production rules with a dedicated service user whose role is exactly the read access the
rules need (read and view_index_metadata on the data streams and .alerts-*, Kibana privileges only in its space), to create and edit rules as
that user (from CI with its API key or password), and to avoid personal accounts editing critical rules. Then a departing engineer, a
password change or a privilege cleanup of a person cannot break a paging rule, and the rule’s api_key_owner, returned by the rule API,
names the service user. Add "who last edited this rule" to the change review of rule definitions kept as code (see
Alerting APIs & Terraform).
Source: Alerting setup (API keys and rule execution), Kibana API: Update the API key for a rule.
Restricting what actions can reach
Connectors send data out of Kibana, which is a security surface of its own. The settings page lists the controls: xpack.actions.allowedHosts
(default ["*"]; an empty array blocks every external connection), xpack.actions.enabledActionTypes (default ["*"]; preconfigured
connectors are unaffected), xpack.actions.ssl.verificationMode (default full), xpack.actions.customHostSettings for per-host TLS and
SMTP overrides, xpack.actions.proxyUrl with proxyBypassHosts or proxyOnlyHosts, xpack.actions.responseTimeout (default 60s) and
xpack.actions.maxResponseContentLength (default 1MB), plus email restrictions xpack.actions.email.domain_allowlist or
xpack.actions.email.recipient_allowlist (since 9.2; the two cannot be combined). In production set allowedHosts to the exact
receivers (for the lab, webhook-receiver), because a user who can create connectors can otherwise send alert payloads to any host
Kibana can reach. Details per connector are on Connectors.
Reference: Alerting and action settings in kibana.yml.
How alerting runs: Task Manager
Rules and actions are persistent background tasks managed by Task Manager, stored in the .kibana_task_manager index. Each Kibana
instance polls for work and runs it on its own Node.js process, next to the user interface. The documented defaults:
-
Tasks are distributed over all Kibana instances of the cluster.
-
Each instance polls every 500 ms (
xpack.task_manager.poll_interval, minimum 100) and runs at most 10 tasks concurrently (xpack.task_manager.capacity, range 5 to 50).xpack.task_manager.max_workersis deprecated since 8.16. Since 8.18 themgetclaim strategy is the default. -
A rule is a recurring task, rescheduled after each run according to its check interval. An action is a non-recurring task, deleted when it completes. One rule is one recurring task; but actions run per alert, so one rule can create many action tasks.
Because the same process serves dashboards and runs rules, a CPU-heavy or long rule can make Kibana unresponsive (the page names expensive Elasticsearch queries and CPU-heavy processing that block the Node.js event loop), and a late or irregular rule run is usually a symptom of capacity, not of a bad rule.
Sizing and scaling
One instance can start up to 10 tasks every 500 ms, so the ceiling is 1,200 tasks per minute: throughput is about capacity times 60,000 divided by the poll interval in milliseconds, and it is lower when tasks take longer than the poll interval. To size a deployment, convert recurring tasks to executions per minute (a 10 s schedule is 6 per minute, a 20 minute schedule 0.05), sum them, add roughly 20 percent for ad-hoc tasks (actions and others) and divide by the per-instance throughput, rounding up. The documentation’s example, 300 tasks every 10 s and 300 every 20 minutes, comes to about 1,815 per minute, so two instances (2,400 per minute) are a sensible start.
For Bookshelf the arithmetic is almost trivial: five lab rules at a 1 minute interval plus the SLO burn rate rules are well under 20 recurring executions per minute, far below one instance’s 1,200. The numbers matter in a platform with thousands of rules; the practical points are:
-
Scale horizontally by adding Kibana instances (each adds 10 concurrent tasks by default; more coordination between instances), when throughput is insufficient and the instances are busy.
-
Scale vertically by raising
xpack.task_manager.capacity(or loweringpoll_interval, which raises Elasticsearch load) when throughput is insufficient but the instances are idle, and also whenlast_polling_delayresets often, which signals conflicts between instances. -
Keep at least one replica of
.kibana_task_managerin production: losing the index loses the scheduled alerts and actions. -
Synchronize the clocks of all nodes with NTP, because tasks are scheduled by time.
-
On Elastic Cloud Hosted and Elastic Cloud Enterprise, Kibana can run dedicated background task nodes; the health endpoint of a UI node then does not reflect task execution, and the troubleshooting guide describes how to retrieve the health data from the task nodes.
Source: Task Manager scaling considerations.
Circuit breakers: protecting Kibana from rules
Kibana lets you cap what a single rule or the whole deployment may do. The settings of the production considerations page:
| Setting | Default | Effect |
|---|---|---|
|
|
Minimum rule check interval (recommended default; cannot exceed |
|
|
When |
|
|
Cap on rule runs per minute: a limit of 400 allows 400 rules at 1 minute or 2,000 at 5 minutes. Rules that would exceed it cannot be created or edited. |
|
|
A run is cancelled after this long. |
|
|
A cancelled run discards its alerts and actions; |
|
none |
Cap on actions per rule run; |
|
|
Alerts one run can generate. Raising it is neither recommended nor supported. |
|
|
Maximum queued actions (since 8.11). |
Without a limit on actions a single rule can schedule enormous numbers of tasks; the page’s examples are 100,000 actions from one
email action and 90,000 from three actions across 30,000 alerts. The lab can run with limits that make mistakes visible, as a fragment of kibana.yml:
xpack.alerting.rules.minimumScheduleInterval.value: "1m"
xpack.alerting.rules.minimumScheduleInterval.enforce: true
xpack.alerting.rules.run.timeout: "2m"
xpack.alerting.rules.run.actions.max: 100
xpack.alerting.rules.run.actions.connectorTypeOverrides:
- id: ".email"
max: 50
When a run hits a limit, the rule’s execution status shows a warning (the API’s reasons are maxExecutableActions, maxAlerts,
maxQueuedActions and ruleExecution) rather than silently dropping work. Lowering the number of alerts per rule is usually the
real fix: a rule that groups by url.path over thousands of URLs wants a coarser group-by, not a bigger limit. Other settings on the
same reference page that are worth knowing are xpack.alerting.alertsService.totalFieldsLimit (default 2,800 for the .alerts-* indices,
since 9.4.3) and xpack.eventLog.logEntries (writes event log entries to the Kibana log, verbose).
Source: Alerting production considerations (sections on short intervals, long-running rules and excessive actions), Alerting settings.
Watching the scheduler: the Task Manager health API
GET /api/task_manager/_health returns the most recent health checks the system has already run, so polling it adds no load, and
Elastic recommends monitoring every instance’s endpoint for services such as Alerting, Actions and Reporting. The feature is Preview on
the Stack, which is not covered by the support SLA. The response has four sections, each with a timestamp and a status of OK,
Warning or Error, plus a root status for the whole system:
| Section | Content |
|---|---|
|
Current settings, including dynamic values such as |
|
Cluster-wide workload: tasks, their types and status. |
|
Execution performance: drift (how late tasks start), worker load and per task type duration and results. |
|
A rough sufficiency estimate from history, not a prediction: |
Read the root status first, then the task types you care about; use runtime for failure and drift, capacity_estimation to decide
whether to scale. One caveat matters for alerting: some tasks, connectors among them, can report success even when the delivery
failed, and the runtime section counts the reported outcome. For the real outcome of actions use the event log below. The failure
thresholds are settings: xpack.task_manager.monitored_task_execution_thresholds defaults to a warning at 80 percent and an error at 90
percent failed executions, and can be set globally or per task type, for example:
xpack.task_manager.monitored_task_execution_thresholds:
default:
warn_threshold: 50
error_threshold: 70
custom:
"alerting:.index-threshold":
warn_threshold: 0
error_threshold: 50
xpack.task_manager.monitored_stats_health_verbose_log.enabled: true
With monitored_stats_health_verbose_log.enabled on, Kibana logs "Detected potential performance issue with Task Manager" messages
when its self-evaluation finds a problem; the same log can be enabled for a delayed task start
(warn_delayed_task_start_in_seconds, default 60). To alert on the alerting system, poll the endpoint from outside Kibana (a Synthetics
HTTP monitor with credentials, or a scheduled script), because the system you are monitoring is the one that would have to send the
alert:
curl -s -u alice:change-me-lab-only "http://localhost:5601/api/task_manager/_health" \
| jq '{status, runtime: .stats.runtime.status, capacity: .stats.capacity_estimation.status}'
The jq paths assume the sections are nested under stats; print the whole response once and adjust the paths to what your version
returns.
The event log: what rules and actions actually did
The event log records what the alerting framework and the actions did, so it answers the questions the Alerts page cannot: whether a
rule ran but its actions did not, whether it ever fired, what error a run raised and how long runs take. The documentation names the
index .kibana-event-log* and, in the production considerations page, describes it as data streams named
.kibana-event-log-<version> (one per Kibana version) with a default retention of 90 days that you can change with the standard data
stream lifecycle APIs; a shorter retention shows less history on the alerting pages. The event log is a technical preview. The key
fields are event.provider (alerting or actions), event.action (execute, new-instance, active-instance,
recovered-instance, execute-action), event.outcome (failure marks failed runs), event.start, event.end, event.duration,
kibana.namespace (the space), the nested kibana.saved_objects (id, type as alert or action, and rel), message and
error.message. In Dev Tools, failed actions of the Bookshelf 5xx rule:
GET .kibana-event-log*/_search
{
"size": 5,
"sort": [ { "@timestamp": "desc" } ],
"query": {
"bool": {
"filter": [
{ "term": { "event.provider": "actions" } },
{ "term": { "event.outcome": "failure" } },
{ "nested": { "path": "kibana.saved_objects",
"query": { "bool": { "filter": [
{ "term": { "kibana.saved_objects.type": "action" } },
{ "term": { "kibana.saved_objects.id": "bookshelf-webhook" } } ] } } } }
]
}
}
}
Use one event.action value per term query (the documentation shows several only as alternatives). Typical error.message
values are a missing saved object or a failed SMTP login; for the lab the likely one is a refused connection to the receiver. This query
is the second half of the "is my alert pipeline working" check, with the Task Manager health as the first.
Source: Event log index, Alerting production considerations (event log lifecycle).
What can go wrong
-
No rule runs after a restart. The encryption key changed or is missing;
decryption_healthiserrorandhas_permanent_encryption_keyisfalse. -
The Alerts page is empty or rules error on read.
search.allow_expensive_queriesisfalse, the API key service is disabled, or the editing user’s privileges were reduced (the rule runs with them). -
Links in notifications are blank.
server.publicBaseUrlis not set, so{{rule.url}}and{{context.alertDetailsUrl}}are empty. -
Rules run late. Capacity: see
capacity_estimationandruntimedrift in the health API; scale as described, or shorten rule work, before blaming the rule type. -
Kibana becomes slow while rules run. A long or CPU-heavy rule blocks the event loop; lower
run.timeout, rewrite the query or move to background-task capacity. -
One rule floods the system. No
actions.maxand a group-by over a high-cardinality field; set limits and coarsen the grouping. -
Actions "succeed" in the health API but nothing arrives. Task Manager counts the reported outcome; look in the event log and in the connector’s own response.
-
Event log history is missing. The retention of the event log data stream is shorter than the history you expect.
-
A rule stopped working after a user left or changed roles. It was owned by that user’s API key; reassign by saving the rule as the service user or by using Update API key as that user.
Hands-on: break and verify the alerting machinery
-
With the
kibanaprofile running, callGET /s/bookshelf/api/alerting/_healthand check that all three substates areok, thathas_permanent_encryption_keyistrueand thatis_sufficiently_secureistrue(in the lab, with security on and Elasticsearch TLS off, the endpoint answeredtrue, so this field did not flag the missing TLS; the page’s documentedfalsefor security without TLS was not reproduced). -
Add the circuit-breaker fragment of this page to the Kibana configuration, restart, and try to save a rule with a 10 second interval; with
enforce: trueKibana must reject it. -
Create a rule owned by
alice, read it withGET /s/bookshelf/api/alerting/rule/<id>and look atapi_key_owner. Removealiceread access tometrics-*in thebookshelf-srerole (or edit as a user without it), save the rule once more, and watch its status turn to error with a read failure; restore the role, use Update API key and check that the rule recovers. -
Call
GET /api/task_manager/_health, note the four section statuses, then raise the number of rules (clone the 1 minute rule 50 times with the rule API) and compareruntimeandcapacity_estimationbefore and after. -
Stop the webhook receiver, trigger the 5xx rule and find the failed
execute-actionevents forbookshelf-webhookin the event log with the query above.
In the books
None of the books covers the alerting setup, Task Manager or the event log of Kibana 9.x. Shah, Kibana 8 Quick Start Guide, chapter 6, creates rules and connectors in the 8.x UI (Stack Management > Alerts and Insights > Connectors) without the operational side, and Konda, Elasticsearch in Action, chapters 14 and 15, and Chhajed, Learning ELK Stack, chapter 9, cover Elasticsearch cluster scaling and production practice rather than Kibana’s scheduler. Rule API keys and the Task Manager health API are newer than all of them. Publisher pages are listed in the bibliography of the section index.