ELK Stack — Alerting
Introduction
Kibana Alerting allows you to define rules that periodically evaluate conditions against your Elasticsearch data and trigger actions when thresholds are breached. Whether you need to page an on-call engineer at 3 AM because error rates spiked, or send a weekly Slack summary of cluster health, Kibana Alerting is the engine behind it.
This section covers rule types, creating alert rules step-by-step, action connectors, alert management, maintenance windows, and rule snoozing.
Alerting Architecture
Kibana Alerting has three core components:
| Component | Description |
|---|---|
| Rule | Defines what to check, how often, and when to alert |
| Connector | Defines where to send notifications (Slack, email, PagerDuty, etc.) |
| Action | Links a rule state (active, recovered) to a connector with a message template |
The evaluation flow:
- Kibana’s Task Manager runs the rule on the configured schedule
- The rule queries Elasticsearch and evaluates conditions
- If conditions are met → alert status becomes Active
- Active alerts trigger configured actions via connectors
- When conditions clear → alert status becomes Recovered
Rule Types
Kibana provides several built-in rule types. The most commonly used ones:
Elasticsearch Query Rule
Fires when an Elasticsearch query returns results matching your conditions.
- Use case: Alert when a specific error message appears in logs
- Query types: KQL, Lucene, or Elasticsearch Query DSL
- Conditions: Number of matching documents exceeds a threshold
Index Threshold Rule
Fires when an aggregated metric crosses a threshold.
- Use case: Alert when average response time exceeds 2 seconds
- Aggregations: Count, average, sum, min, max
- Conditions: Is above, is below, is between, etc.
Log Threshold Rule (Observability)
Fires when the rate of log entries matching a condition exceeds a threshold.
- Use case: Alert when more than 100 ERROR logs per minute
- Requires: Observability plugin and log data
Metric Threshold Rule (Observability)
Fires when infrastructure metrics cross a threshold.
- Use case: Alert when CPU usage > 90% for 5 minutes
- Requires: Metrics data from Metricbeat or Elastic Agent
Anomaly Detection Rule (Machine Learning)
Fires when an ML anomaly score exceeds a severity threshold.
- Use case: Alert on unusual login patterns detected by ML jobs
Creating an Alert Rule Step-by-Step
Here is a complete walkthrough of creating an Index Threshold rule that alerts when the error count exceeds 50 in a 5-minute window.
Step 1 — Navigate to Rules
- Open Stack Management → Rules (or Observability → Alerts → Manage Rules)
- Click Create rule
Step 2 — Configure Rule Details
- Name:
High Error Rate — Production - Tags:
production,errors,p1 - Check every:
1 minute - Notify:
On status changes(avoids alert storms)
Step 3 — Select Rule Type
- Choose Index threshold
- Configure the condition:
- Index:
logs-* - Timestamp field:
@timestamp - Aggregation:
count() - When:
is above - Threshold:
50 - Over the last:
5 minutes - Group by:
host.name(optional — creates per-host alerts)
- Index:
Step 4 — Add Actions
- Click Add action
- Select a connector type (e.g., Slack)
- Choose an existing connector or create a new one
- Configure the action:
- Run when:
Alert is active - Message:
- Run when:
🚨 High Error Rate Alert
Host: {{context.group}}
Error count: {{context.value}} in last 5 minutes
Threshold: {{context.threshold}}
Timestamp: {{context.date}}
View in Kibana: {{context.link}}
- Optionally add a recovery action (when alert resolves):
- Run when:
Recovered - Message:
✅ Error rate for has returned to normal.
- Run when:
Step 5 — Save
Click Save to create the rule. It will begin evaluating immediately.
Action Connectors
Connectors are reusable integrations that actions use to deliver notifications.
Built-in Connector Types
| Connector | Description | Common Use |
|---|---|---|
| SMTP email delivery | Team distribution lists | |
| Slack | Post to Slack channel or DM | Real-time team notifications |
| PagerDuty | Create/resolve PD incidents | On-call incident management |
| Webhook | HTTP POST to any URL | Custom integrations |
| Jira | Create Jira issues | Ticket-driven workflows |
| ServiceNow | Create ServiceNow incidents | Enterprise ITSM |
| Microsoft Teams | Post to Teams channel | Team notifications |
| Opsgenie | Create Opsgenie alerts | Incident management |
| Server log | Write to Kibana server log | Debugging and audit |
| Index | Write alert data to an ES index | Alert history and analytics |
Creating a Slack Connector
- Open Stack Management → Connectors
- Click Create connector
- Select Slack
- Enter a name — e.g.,
SRE Slack Channel - Choose API type:
- Webhook URL — paste a Slack incoming webhook URL
- Slack API — use a Slack Bot token for richer features
- Click Save & test
- Send a test message to verify
Creating a PagerDuty Connector
- Open Stack Management → Connectors
- Click Create connector → PagerDuty
- Enter the API URL — default:
https://events.pagerduty.com - Enter the Integration Key (from your PagerDuty service)
- Click Save & test
Creating a Webhook Connector
For custom integrations (e.g., posting to a Discord channel or internal API):
- Open Stack Management → Connectors
- Click Create connector → Webhook
- Configure:
- URL:
https://your-api.example.com/alerts - Method: POST
- Headers:
Content-Type: application/json - Authentication: Basic, SSL, or none
- URL:
- Click Save & test
Action Frequency
Control how often actions fire to avoid alert fatigue:
| Option | Behavior |
|---|---|
| On status changes | Fire once when alert activates, once when it recovers |
| On every check | Fire every time the rule evaluates and the alert is active |
| Custom frequency | Fire at most every N minutes/hours while alert is active |
Best practice: Use On status changes for paging connectors (PagerDuty) and Custom frequency (every 1 hour) for email summaries.
Alert Status and Management
Alert States
| State | Meaning |
|---|---|
| Active | Conditions are met; actions are firing |
| Recovered | Conditions are no longer met; recovery actions fire |
| Untracked | Alert was manually untracked; no actions fire |
| Flapping | Alert is rapidly toggling between active and recovered |
Managing Alerts
- Open Stack Management → Rules to see all rules
- Click a rule to view its alert history
- Use the Alert table to see individual alert instances
- Mute an individual alert to suppress actions without disabling the rule
Maintenance Windows
Maintenance windows allow you to suppress alert notifications during planned downtime.
Creating a Maintenance Window
- Open Stack Management → Maintenance Windows
- Click Create maintenance window
- Configure:
- Name:
Monthly Patch Window - Schedule: Set start and end time
- Recurrence: One-time, daily, weekly, monthly, or custom
- Filter: Optionally limit to specific rule tags (e.g.,
production)
- Name:
- Click Save
During the maintenance window, rules continue to evaluate, but actions are suppressed. Alert state changes are still recorded.
Example — Recurring Weekly Maintenance
For a weekly deployment window every Thursday 2 AM–4 AM UTC:
- Name:
Weekly Deployment Window - Start: Next Thursday, 02:00 UTC
- End: Next Thursday, 04:00 UTC
- Recurrence: Weekly on Thursday
- Filter by tags:
production
Rule Snoozing
Snoozing temporarily silences a specific rule without creating a full maintenance window.
How to Snooze a Rule
- Open Stack Management → Rules
- Find the rule you want to snooze
- Click the three-dot menu → Snooze
- Select duration:
- 1 hour, 3 hours, 8 hours, 1 day
- Custom end time
- Indefinitely (until manually un-snoozed)
- The rule icon shows a snooze badge
Snoozing vs. Disabling vs. Muting
| Action | Rule evaluates? | Actions fire? | Use case |
|---|---|---|---|
| Enabled | Yes | Yes | Normal operation |
| Snoozed | Yes | No | Temporary suppression |
| Muted alert | Yes | No (for that alert) | Suppress one alert instance |
| Disabled | No | No | Full stop |
Example Configurations
Production Error Rate Alert with Multi-Channel Notification
A platform team sets up tiered alerting:
Rule: Critical Error Rate
- Check every: 1 minute
- Index threshold on
logs-* - Condition:
count() > 100over last 5 minutes, grouped byservice.name
Actions:
- PagerDuty — runs on status change → creates/resolves incidents
- Slack #sre-alerts — runs on status change → posts alert details
- Index connector → writes alert data to
alert-history-*for dashboarding
Maintenance window: Suppress during weekly Thursday 2–4 AM deployment window.
Daily Report via Email
Rule: Daily Log Summary
- Check every: 24 hours (at 08:00 UTC)
- ES query: Always matches (ensures daily execution)
Action:
- Email connector → sends summary to
team@company.com - Message template includes count of errors, warnings, and top error messages
Quick Reference
| Task | Steps |
|---|---|
| Create a rule | Stack Management → Rules → Create rule |
| Create a connector | Stack Management → Connectors → Create connector |
| Set action frequency | Rule → Action → Run when → choose frequency |
| View alert history | Stack Management → Rules → click rule → Alerts tab |
| Create maintenance window | Stack Management → Maintenance Windows → Create |
| Snooze a rule | Rules → three-dot menu → Snooze |
| Mute an individual alert | Rule → Alerts tab → Mute |
| Test a connector | Stack Management → Connectors → Test tab |
| Filter rules by tag | Rules list → Tags filter |
Next: Reporting and Spaces →