Back to Skills

kibana-alerting-rules

Create and manage Kibana alerting rules via REST API or Terraform. Use when creating, updating, or managing rule lifecycle (enable, disable, mute, snooze) or rules-as-code workflows.

531stars41forksUpdated 7/9/2026

Security Assessment

Low Risk(85/100)

Detected risks:

Secret Exposure([SKILL.md] api_key =)
Security Score85/100

About kibana-alerting-rules

A reference for creating and managing Kibana alerting rules through both the REST API and Terraform, covering the full rule lifecycle and rules-as-code workflows. It frames a rule as three parts: conditions (what to detect), a schedule (how often to check), and actions (what happens when conditions are met), where met conditions create alerts that trigger actions through connectors. Authentication requires API key or Basic auth, and every mutating request must include the kbn-xsrf: true header; required privileges are all for the relevant Kibana feature (Stack Rules, Observability, or Security) plus read for Actions and Connectors. An API table maps operations to endpoints under <kibana_url>/api/alerting (or /s/<space_id>/... for non-default spaces): create (POST rule/{id}), update (PUT), get, delete, find (rules/_find), list rule types, enable, disable, mute and unmute all, mute and unmute a specific alert, update API key, create and delete snooze schedules, and health check. Rule creation documents required fields (name, rule_type_id such as .es-query or .index-threshold, consumer such as alerts, apm, logs, metrics, securitySolution, or stackAlerts, params, and schedule like {"interval":"5m"}) plus optional fields including actions, tags, enabled, notify_when, alert_delay (for example {"active":3}), and flapping. A full curl example builds an Elasticsearch query rule with an index, timeField, esQuery, threshold and comparator, time window, and a Slack-connector action, and it notes that GET rule_types reveals params schemas. Updating sends the complete body (rule_type_id and consumer are immutable) and can return 409 Conflict for concurrent edits, prompting a re-fetch and retry. Finding rules supports pagination, search, sorting, and KQL filter parameters. Lifecycle operations for enable, disable, mute, and delete are shown, and a Terraform section uses the elasticstack provider's elasticstack_kibana_alerting_rule resource. Useful for alert automation and rules-as-code across Kibana spaces.

FAQ

What three parts make up a Kibana rule?

Conditions (what to detect), a schedule (how often to check), and actions (what happens when conditions are met); met conditions create alerts that fire actions through connectors.

What authentication and headers are required?

API key or Basic auth on all calls, plus the kbn-xsrf: true header on every mutating request; you also need all privileges for the relevant feature and read for Actions and Connectors.

Which fields are required to create a rule?

name, rule_type_id (for example .es-query or .index-threshold), consumer, params, and schedule; actions, tags, enabled, notify_when, alert_delay, and flapping are optional.

Can I change a rule's type or consumer after creation?

No. rule_type_id and consumer are immutable after creation, and updates via PUT must send the complete rule body.

How do I manage rules as code?

Use the elasticstack Terraform provider's elasticstack_kibana_alerting_rule resource, configured with your Kibana endpoint and API key.

Install kibana-alerting-rules

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill