Kibana Guide: Observability Rules and SLOs

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-11 against Kibana 9.5.x.

What you build

You create three things on the Bookshelf logs. A Custom threshold rule, Guide Bookshelf error ratio, divides the number of ERROR log lines by the number of all log lines and raises one alert per URI when the ratio goes above 0.3. A second rule, Guide Discover error logs, starts from a query in Discover. An SLO, Guide Bookshelf availability, counts the log lines that are not errors as good events, and the rule Guide SLO burn rate alerts when that SLO consumes its error budget too fast. The finished alerts show up in the Observability Alerts page, one row for each group.

Observability Alerts page of Kibana 9.5 listing three Active alerts of the rule Guide Bookshelf error ratio, one per value of attributes.uri, with observed values above the threshold 0.3

Before you start

  • Start the Kibana profile of the hands-on lab and wait about a minute:

    cd lab
    docker compose --profile kibana up -d
  • Open http://localhost:5601 and sign in as elastic with the password lab-elastic-password. When Kibana opens its full-screen welcome page, click Explore on my own.

  • Do the previous guide, Create a rule with a connector. This guide does not need the webhook connector, because the rules below have no action, but it uses the same Rules pages. It also needs the data view Bookshelf logs (guides) from Upload a file and create a data view.

  • Licence: custom threshold rules and SLOs are Observability features. The SLO burn rate rule type needs a Platinum licence, which the trial licence of the lab includes. Check the licence with curl -s -u elastic:lab-elastic-password http://localhost:9200/_license.

  • What the lab feeds: the collector sends the Bookshelf logs, the traces and the APM aggregates to Elasticsearch. It sends no OpenTelemetry metrics data stream, so there are no host or system metrics. The Inventory and Metric threshold rules, the Hosts page and any CPU or memory rule have nothing to evaluate in this lab. The guide therefore builds every rule on the logs.

  • Not run end to end: the Custom threshold form, the SLO form and the burn rate rule were not completed in the lab. The labels of those screens follow the Elastic documentation and may differ slightly from yours. The steps name the control and the value to enter; follow the control, not the exact position.

  • The figures are drawings of the Kibana 9.5 user interface, not screenshots, so small details can differ from your screen. A highlighted box with a number marks the control of the step with the same number.

Steps

Four screens are used: the Rules page of Stack Management, the rule page with its three steps (Definition, Actions, Details), Discover and the SLO create page. The earlier guide in this series, Create a rule with a connector, shows the rule form on a map; come back to it when a control of a rule page is not where a figure shows it.

Open the rule form

  1. Click the menu button (Toggle primary navigation) at the left of the second bar and, under Management, click Stack Management.

  2. In the left menu, under Alerts and Insights, click Rules.

  3. Click Create rule.

    Rules page of Stack Management in Kibana 9.5 with the left menu open on Alerts and Insights; Rules in the left menu is marked by callout 2 and the Create rule button by callout 3
  4. In the flyout Create new rule, on the tab Rule type, click the card Custom threshold ("Alert when any Observability data type reaches or exceeds a given value."). It is listed in the category Observability.

    Create new rule flyout of Kibana 9.5 with the Rule type tab, a category list with Observability selected and the Custom threshold card; the card is marked by callout 4

Define the error ratio

The rule divides two document counts. Aggregation A counts the ERROR lines, aggregation B counts every line, and the equation A / B is the share of errors.

  1. In Select a data view, choose Bookshelf logs (guides).

  2. Define aggregation A: the aggregation type Count, and in its KQL filter type the query below.

    severity_text : "ERROR"
  3. Add aggregation B with Add aggregation: the type Count again, with no filter, so that it counts every document.

    Definition step of the Custom threshold rule in Kibana 9.5: the data view Bookshelf logs (guides) is marked by callout 5, aggregation A is a Count with the KQL filter severity_text : ERROR marked by callout 6, and aggregation B is a Count without a filter marked by callout 7
  4. In Custom equation, type A / B.

  5. Set the condition to Is above 0.3 for the last 1 minute. In failing mode the load generator logs an ERROR line for about 70 percent of the requests, far above this ratio; in normal mode the share of errors is small.

  6. In Group alerts by, choose the field attributes.uri. The rule then keeps one alert for each URI instead of one for the whole service.

  7. In Rule schedule, keep Every 1 minute.

    Definition step of the Custom threshold rule with the Custom equation A / B marked by callout 8, the condition Is above 0.3 for the last 1 minute marked by callout 9, Group alerts by attributes.uri marked by callout 10 and the Rule schedule Every 1 minute marked by callout 11

Name and save the rule

Step 2, Actions, is optional and stays empty: the alert is read in the Alerts page. Open step 3, Details.

  1. In Rule name, type Guide Bookshelf error ratio.

  2. In Tags, type guide.

  3. Click Create rule.

    Details step of the rule page in Kibana 9.5 with the Rule name Guide Bookshelf error ratio marked by callout 12, the tag guide marked by callout 13 and the Create rule button marked by callout 14

Create a rule from Discover

A query that already finds the documents you care about can become a rule. In 9.5 Discover has no entry called "Create search threshold rule" (the name used in older releases); the entry is Create alert rule in the More menu.

  1. Click the menu button and, under Analytics, click Discover.

  2. In the data view picker, choose Bookshelf logs (guides).

  3. In the query bar, type the query below and press Enter. The histogram shows only the ERROR lines.

    severity_text : "ERROR"
  4. Click More in the second bar and then Create alert rule.

    Discover in Kibana 9.5 on the data view Bookshelf logs (guides) with the query bar holding the ERROR filter, marked by callout 17, and the More menu open; its last entry Create alert rule is marked by callout 18
  5. A rule-type chooser opens. Choose Elasticsearch query, the rule type that evaluates a search. This chooser was not opened in the lab, so its layout may differ from what you expect; if Kibana has already opened a rule page, go on with the next step.

  6. Check that the rule page shows the data view Bookshelf logs (guides) and the query severity_text : "ERROR". If either is empty, select it or type it.

  7. Set the condition to WHEN count() OVER all documents IS ABOVE 20 FOR THE LAST 5 minutes.

    Definition step of the Elasticsearch query rule in Kibana 9.5: the data view Bookshelf logs (guides) and the KQL query severity_text : ERROR carried over from Discover are marked by callout 20, and the condition WHEN count() OVER all documents IS ABOVE 20 FOR THE LAST 5 minutes is marked by callout 21
  8. In step 3, Details, type the Rule name Guide Discover error logs. If you did the previous guide, use a name different from its rule Guide Bookshelf error logs.

  9. Click Create rule.

Create an SLO

An SLO turns "most requests are fine" into a number: a target for the share of good events over a time window. The rest of this guide defines that share on the Bookshelf logs. The SLOs page and its create form were read in the lab but not completed.

  1. Click the menu button and, under Observability, click SLOs.

  2. Click the button that creates an SLO, Create SLO. It opens the page Create SLO, which has three numbered blocks: Define SLI, Set objectives and Describe SLO.

  3. Under Choose the SLI type, choose Custom Query. The other types are Custom Metric, Timeslice Metric, Histogram Metric, APM latency, APM availability and Synthetics availability.

  4. In Index, open the picker Select a Data view and choose Bookshelf logs (guides).

  5. In Timestamp field, choose @timestamp.

  6. In Good query, type the query below. A log line counts as good when it is not an ERROR line.

    NOT severity_text : "ERROR"
  7. Leave Total query, Query filter and Group by empty, so that every log line is a total event, and check the SLI preview chart.

    Create SLO page of Kibana 9.5, block 1 Define SLI: the SLI type Custom Query is marked by callout 26, the Index Bookshelf logs (guides) by callout 27, the Timestamp field @timestamp by callout 28 and the Good query NOT severity_text : ERROR by callout 29; the Total query is empty and an SLI preview chart sits at the right
  8. In block Set objectives, choose a rolling time window of 7 days. Pick a short window: the lab has only minutes of history.

  9. Choose the budgeting method Occurrences, which compares good events with total events.

  10. Set the target to 99 percent.

    Create SLO page of Kibana 9.5, block 2 Set objectives, drawn generically: the time window 7 days is marked by callout 31, the budgeting method Occurrences by callout 32 and the target 99 percent by callout 33
  11. In block Describe SLO, type the name Guide Bookshelf availability.

  12. Click Create SLO.

    Create SLO page of Kibana 9.5, block 3 Describe SLO, drawn generically: the SLO name Guide Bookshelf availability is marked by callout 34 and the Create SLO button by callout 35

Add a burn rate rule

Kibana creates a default burn rate rule when an SLO is saved. It has default settings and no connector. Here you create your own rule, to see the form and the rule type.

  1. Open Stack Management → Rules as in steps 1 to 3 and click Create rule. The category list of the flyout has an entry SLOs.

  2. Click the card SLO burn rate.

    Create new rule flyout of Kibana 9.5 with the category SLOs selected, drawn generically with an SLO burn rate card; the card is marked by callout 37
  3. In the SLO selector, choose Guide Bookshelf availability.

  4. Keep the burn rate windows the form proposes. Each window has a lookback period, a burn rate threshold and a severity.

  5. In step 3, Details, type the Rule name Guide SLO burn rate.

  6. Click Create rule.

    SLO burn rate rule page of Kibana 9.5, drawn generically: the SLO Guide Bookshelf availability is marked by callout 38, the four default burn rate windows by callout 39, the rule name Guide SLO burn rate by callout 40 and the Create rule button by callout 41

Check the result

Force errors and wait for the next runs of the rules:

curl -X POST localhost:8090/mode/failing

Open the menu, then Observability → Alerts. After a few minutes the rule Guide Bookshelf error ratio must show alerts with the status Active, one for each URI that returns errors, with an observed value above the threshold 0.3. The rule Guide Discover error logs shows one alert.

The SLO list under Observability → SLOs shows the SLO Guide Bookshelf availability with its current SLI and the remaining error budget; the SLI drops while the failing mode runs. This was not observed in the lab. The burn rate rule works on lookback periods of hours, so do not expect Guide SLO burn rate to become active within minutes of a short failure.

Restore normal traffic afterwards:

curl -X POST localhost:8090/mode/normal

The active alerts recover on the next runs once the last minute is clean.

Variations

  • Add a second action group to the Custom threshold rule with Add warning threshold, so that crossing a lower ratio gives a warning and crossing 0.3 gives the alert; the reference page on Observability rules explains it.

  • Group the SLO by a field with Group by, for example attributes.uri, to get one SLO instance for each URI.

  • The lab sends traces, so the APM rule types (for example the failed transaction rate) can alert on the bookshelf service. They are not part of this guide.

What can go wrong

Symptom Cause Fix

Custom threshold is not in the picker

The search box of the flyout still holds a text, or the category is another one.

Clear the search and choose the category Observability, or type Custom threshold.

The data view Bookshelf logs (guides) is not in the list

The guide that creates it was skipped.

Do the data view guide first and reopen the form.

The alert never becomes active

The lab is in normal mode, so the ratio of ERROR lines is below 0.3, or the group field has no values.

Check the mode with curl localhost:8090/, send curl -X POST localhost:8090/mode/failing, and check that the field attributes.uri has values in Discover.

The rule page shows no Create alert rule entry in Discover

The menu More is the one of another tab, or the page is in ES|QL mode.

Use the data view mode of Discover and a KQL query; older releases call the entry Create search threshold rule.

SLO burn rate is greyed or missing

The licence is not Platinum or trial.

Check the licence with curl -s -u elastic:lab-elastic-password http://localhost:9200/_license; the lab starts a trial licence.

The SLO page shows no data

The SLO transform has not produced its first results yet, or the index and timestamp field are wrong.

Wait a few minutes, check Index and Timestamp field in the SLO definition and the SLI preview.

Clean up

Keep the rules and the SLO if you follow the next guide, which acknowledges and snoozes their alerts. To remove them, delete the three rules in Stack Management → Rules and the SLO and its default burn rate rule in Observability → SLOs. Stopping the profile with docker compose --profile kibana down -v deletes everything the lab stores.

Where to go next