Dec 5th, 2026: [EN] Dear Santa, here's how to know if the kids are still awake

Every Christmas Eve, Santa has exactly one real problem: a child who isn't asleep. Billions of chimneys, one night, and zero tolerance for a sleepy "wait… is that… Santa?"

This year the elves put motion, noise and light sensors under the Christmas trees and stream the readings into Elasticsearch. Now Santa needs something that watches the stream for him and taps him on the shoulder at the right moment, and only then.

That's a job for Universal Alerting: rules written in ES|QL, plus action policies that decide who hears about an alert, how often, and how. Universal Alerting is available in Observability. Otherwise, outages in the workshop could delay toys making it to children in time.

"Available in Elastic 9.6"

The data

One document per sensor reading in an index called tree-sensors:

{
 "@timestamp": "2026-12-24T23:41:07Z",
 "house": { "id": "zoe-8yo-paris", "city": "Paris" },
 "noise_db": 47,
 "light_lux": 120,
 "motion_events": 4
}

Step 1: a rule that spots an awake kid

A rule only answers one question: what is happening? It never sends anything. Here's Santa's:

POST kbn:/api/alerting/v2/rules
{
 "kind": "alert",
 "metadata": {
  "name": "Kid spotted near the tree",
  "description": "Noisy and moving around the tree, two checks in a row.",
  "tags": ["christmas"],
  "routing_tags": ["santa-stealth"]
 },
 "schedule": { "every": "1m", "lookback": "5m" },
 "query": {
  "base": "FROM tree-sensors | STATS avg_noise = AVG(noise_db), motion = SUM(motion_events) BY house.id, house.city | EVAL severity = CASE(motion >= 10, \"critical\", \"high\")",
  "breach": { "segment": "WHERE avg_noise > 40 AND motion >= 3" }
 },
 "grouping": { "fields": ["house.id", "house.city"] },
 "recovery": { "strategy": "no_breach" },
 "no_data": { "strategy": "keep_last" },
 "state_transition": { "pending": { "count": 1 }, "recovering": {    "count": 1 } }
}

What's going on:

  • base + breach: the ES|QL that computes the numbers, and the condition that makes a row a problem.
  • grouping: every house gets its own alert, so Zoe in Paris and Max in Vienna never get mixed up.
  • state_transition: a creaking floorboard isn't an awake kid. The alert goes `pending` on the first match and only becomes `active` on the second one in a row. It closes the same way once the house goes quiet.
  • no_data: keep_last: if a sensor goes silent, don't assume the kid fell asleep. The alert keeps whatever status it had.
  • severity: any column called `severity` in the query output becomes the alert's severity. A kid doing laps around the tree is `critical`.
  • routing_tags: a label that action policies can match on. Hold that thought.

Step 2: the dispatcher decides who gets woken up

The rule found an awake kid. Now what? Not the rule's problem. Alerts are written as events, and a separate dispatcher reads them. It runs on its own schedule (every 5 seconds), and for each alert it:

  1. checks whether someone already acked or snoozed it,
  2. finds the action policies that match it,
  3. groups the matches,
  4. throttles repeats,
  5. sends what's left to a workflow, which is what actually emails, pages or posts to chat,
  6. writes down what it decided.

Every alert gets a recorded outcome: dispatched, throttled (Santa already heard about it), suppressed (someone acknowledged or snoozed it) or unmatched (no policy wanted it). Nothing disappears silently.

Santa wants two things. A loud alarm on the sleigh when it's critical:

POST kbn:/api/alerting/v2/action_policies
{
 "name": "Sleigh alarm",
 "matcher": { "tags": ["santa-stealth"], "expression": "severity: critical" },
 "grouping": { "mode": "per_alert" },
 "throttle": { "strategy": "on_status_change" },
 "destinations": [{ "type": "workflow", "id": "<sleigh-alarm-workflow-id>" }]
}

…and a calm digest for the elves, one message per city every ten minutes instead of forty pings from the same street:

POST kbn:/api/alerting/v2/action_policies
{
 "name": "Elves digest",
 "matcher": { "tags": ["santa-stealth"] },
 "grouping": { "mode": "per_field", "fields": ["data.house.city"] },
 "throttle": { "strategy": "time_interval", "interval": "10m" },
 "destinations": [{ "type": "workflow", "id": "<elves-digest-workflow-id>" }]
}

The matcher mixes routing tags with a KQL expression over the alert (severity, alert_status, anything from your query under data.*). grouping and throttle have to agree: one-alert-at-a-time pairs with on_status_change, digests pair with time_interval. Both policies match a critical alert, so the elves get their digest and the sleigh gets its alarm.

A destination is a workflow, a small YAML file that receives the whole notification group:

version: "1"
name: "Elves: awake-kids digest"
enabled: true
triggers:
 - type: manual
  inputs:
   properties:
     payload:
      $ref: "#/kibana/definitions/alertingV2NotificationGroup"
steps:
 - name: tell_the_elves
   type: email
   connector-id: <your-email-connector-id>
   with:
     to:
      - elves@northpole.example
     subject: "{{ inputs.payload.alerts | size }} house(s) still awake"
     message: |
       {%- for alert in inputs.payload.alerts -%}
       **{{ alert.data.house.id | default: "unknown house" }}** ({{ alert.data.house.city | default: "somewhere" }}) · {{ alert.severity | capitalize }} · [Open alert]({{ alert.alert_url }})
       {% endfor -%}

The | default guards matter: data is the ES|QL row, and it's empty once an alert recovers. Workflow validation rejects the unguarded version.

Santa's on a light sleeper's roof and wants radio silence? Snooze the digest for half an hour:

POST kbn:/api/alerting/v2/action_policies/<elves-digest-policy-id>/_snooze
{ "snoozed_until": "2026-12-25T00:15:00Z" }

Step 3: Santa's busy? Send in the elves

Writing JSON mid-flight is nobody's idea of fun. So the elves open Agent Builder in Kibana and just ask:

Create an alert rule on `tree-sensors`, grouped by house, that fires when average noise is above 40 dB and there are at least 3 motion events in the last 5 minutes. Critical above 10 motion events, two checks in a row, routing tag `santa-stealth`.

Agent Builder's alerting skills draft the rule right in the conversation. Ask for a notification next ("digest per city every 10 minutes") and the action-policy skill drafts that too. Nothing is created until a human clicks Create rule. Elves draft, Santa approves. (These alerting skills currently show up in Observability projects and in Classic or Observability spaces.)

Merry Christmas, everyone's asleep

The sensors are quiet, the alerts are inactive, and Santa's inbox is empty. Rule says what happened, policy says who needs to know, workflow does the telling.

Want to try it? Enable Universal Alerting in Kibana's Advanced Settings and tell us what you'd build.

Happy holidays from the Rules and Alerting team :christmas_tree:

2 Likes