On this page
Alerts & Incidents
Turn any saved query into an alert, and every alert into an incident with a history.
An alert rule is an ObiQL query plus a condition - fire when the query matches more than N events in a window. Rules are created from the Log Explorer without losing your place, evaluated on a schedule, and every firing becomes a searchable, GitOps-manageable record.
Create an alert from a search
After running a search in the Log Explorer, a Create Alert button opens a drawer alongside the results:
- Query - the current search, filters and time range included.
- Condition - event count above a threshold in a window, pre-filled from the current result count.
- Evaluation interval - how often the rule runs, separate from the window it looks back over.
- Notifications - Slack, email, PagerDuty, or a generic webhook, configured inline on the rule, plus any notification groups you pick.
The drawer closes back onto the same Explorer view, so the query you were already running is undisturbed.
Custom webhook bodies
A webhook notification sends a standard JSON body by default. To reshape it
for the receiving system, open Custom body under the webhook URL and write
a JSON template. Tokens written as $name$ are filled in from each firing:
{
"text": "Alert $alert.name$ fired at $trigger_time$",
"severity": "$alert.severity$",
"count": $result_count$,
"first_message": "$result.message$",
"link": "$results_link$"
}
Values are escaped for where they appear. Inside a JSON string a token is
inserted as string content, so a log line containing a quote cannot break the
body. Outside a string it is inserted as a JSON value: a number stays a
number, a list becomes an array, and a missing value becomes null. Write
$$ for a literal dollar sign. Clear the template to go back to the default
body, and use Preview to render it against a sample alert before saving.
| Token | Value |
|---|---|
$alert.name$ | The alert's name. |
$alert.id$ | The alert's id. |
$alert.description$ | The alert's description, or empty when it has none. |
$alert.severity$ | The severity this notification is sent with, the same one PagerDuty receives. |
$alert.link$ | A link to the alert in the console. |
$trigger_time$ | When the alert fired, as an ISO 8601 timestamp. |
$trigger_time_epoch$ | When the alert fired, as seconds since the Unix epoch. |
$event.id$ | The number of this firing within the alert. |
$incident.id$ | The incident this firing belongs to, or empty when it has none. |
$series$ | Which series fired, for an alert that fires per series. Empty otherwise. |
$query$ | The query the alert evaluates. |
$result_count$ | How many events matched in the window. |
$metric_value$ | The value compared against the threshold. |
$window_seconds$ | The length of the evaluation window, in seconds. |
$results_link$ | A link to the matching events in Explorer. |
$sparkline$ | Recent match counts, as an array of numbers. |
$results$ | Up to 5 matching events, as an array of objects. |
$trace_ids$ | Up to 5 trace ids from the matching events, as an array. |
$result.<field>$ | A field of the first matching event, such as $result.message$ or $result.service$. Empty when the field is missing. |
$default_payload$ | The whole body sent when no custom body is set, as an object. |
Notification groups
A notification group is a named list of destinations (email, Slack, PagerDuty or webhook) that you define once and reuse. Manage them in Preferences, Notifications. Creating, editing and applying a group needs the Admin or Owner role.
A group can apply to:
- A whole category - all custom alerts, every alert of one managed kind, all Obi agents, Liveness Checks, API sources, the Data Catalogue, data inputs, data flows or backups. Tick it under Bulk apply on the group's page. Items added later are covered too.
- Single alerts and agents - pick the group in the Notification groups list in the alert or agent editor. Each group there has a ✕. On a group attached to that alert, it removes it. On a group that reaches the alert through a category or as a default group, it removes it from that one alert only, while every other alert keeps it. Add back (or Opt back in) undoes it.
- Every alert - make it a default group.
Groups add to an item's own destinations rather than replacing them, so an alert can keep its own Slack channel and also notify a team's group. Edit a group once and the change applies everywhere it is used. Disabled group destinations are skipped, and a destination that appears more than once (on the alert and in a group, or in two groups) gets one message. Email goes one further: a person reached several ways for one alert (named on the alert, in a role, and in two groups) gets one email.
Default groups
A default group notifies for every alert in the workspace, including alerts created later: your own alerts, every add-on's alerts, and the alerts for failing API polling sources, data flows, data inputs and backups, and Data Catalogue drift. Turn it on or off with the Default switch in the groups table on Preferences, Notifications, or with Notify this group for every alert in the group's own settings. A workspace can have as many default groups as it likes, or none.
Every workspace starts with one, Workspace members, which emails every member of the workspace. It is an ordinary group, so you can edit it, add destinations to it, turn its default off or delete it.
Default groups are worked out when an alert fires, so a change reaches every alert straight away: turning a group's default on or off, or changing who is in it.
To take a default group off some alerts only:
- One alert - press ✕ next to the group in that alert's Notification groups.
- Every alert of one add-on - press ✕ next to the group in that add-on's Alert settings. Alerts the add-on adds later leave it off too.
- API polling sources or data flows - press ✕ next to the group in their notification settings.
Default groups also start ticked on every new war room, so its updates reach them. Untick one when you create a war room to leave it out of that room. On War room defaults they are listed as default groups and cannot be removed there.
Obi agents and scheduled dashboard reports are not alerts, so default groups do not reach them. They use the groups and destinations you give them.
Add-on alerts start switched off. Switch on the ones you want, one by one or with Enable all, on the add-on's Alert Rules page. Once on, they notify your default groups.
Groups shared by your organization
If your workspace belongs to an organization, the organization can keep groups that every one of its workspaces can use. That way one on-call rotation is kept in one place, not copied into each workspace.
- Organization Owners and Admins create and edit shared groups in Preferences, Organization, on the Notifications tab.
- In each workspace, shared groups appear with an Organization chip beside their name, after the workspace's own groups. A workspace's Admins and Owners attach them the same way as their own groups. The organization never attaches anything for you.
- Everyone in the workspace can see a shared group's email addresses. Slack, PagerDuty and webhook details stay hidden outside the organization's settings.
- An email to a role, or to everyone, goes to those people in the workspace that sends it. A shared group can't email one named member, so use their address instead.
- When a workspace leaves the organization, shared groups stop notifying for it at once.
The same page's Manage existing notifications card lists everything that sends notifications, with each item's own destinations and the groups that apply to it. Search or filter by category, select rows, and apply or remove a group in bulk. Tick Replace their own destinations to remove the selected items' own destinations at the same time, so the group becomes what notifies them. Remove own destinations removes them without applying a group, for example once a group already covers those items. A managed alert that follows its kind's shared list has no own list to remove and is skipped.
Incidents
Related alert events are grouped automatically into incidents, so an outage that trips several rules pages an on-call engineer once, not once per rule. Grouping uses shared labels and how close together the alerts started. Each incident has a lifecycle - open, acknowledged, resolved - and a full timeline of every contributing alert.
With the Obi AI Assistant add-on on, a rule can also have Obi investigate each new incident it opens, read-only, and attach what it finds to the incident. See Investigate alerts.
To keep people outside the team informed while an incident runs, open a war room on it: one plain-language page about what is happening and what is affected, kept up to date by Obi and your team.
Alert health
Every rule carries a health score computed from how often it fires and resolves within minutes (noise), how long it stays open, and how often it's silenced. The Alert Health view sorts rules worst-first so a team can prune alerts nobody acts on before they erode trust in the rest.
Silences
A silence withholds notifications for a rule over a time window without pausing evaluation - firings still record in history, only the outbound notification is held back. Useful for planned maintenance without losing the rule's own signal.
Backtesting a rule before you trust it
A proposed rule can be run against history you have already collected, so you can see what it would have done before anything is allowed to page anyone:
curl https://api.obistack.com/v1/alerts/backtest \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "level=error service=payments",
"conditionType": "log_volume",
"conditionOperator": ">",
"conditionThreshold": 50,
"windowSeconds": 300,
"window": "7d"
}'
windowSeconds is the window the condition looks back over on each
evaluation; window is how much history to replay the rule across, one of
1d, 3d, 7d, 14d, or 30d. A rule that would have fired two hundred
times last week is a rule you want to fix now, not at 3am.
Unit tests for alert rules
Most alerting tools leave you to find out whether a rule works when it fires, or when it fails to. In ObiStack a rule can carry its own tests: a few sample events, and whether the rule should fire on them or stay quiet.
Open a rule, choose Tests, and select Add test. Paste sample events one JSON object per line, the way a sender would send them, and choose whether the rule should fire. Try it checks the test before you save it, and the Tests tab shows every test's latest result along with what the rule measured.
{"level":"error","service":"checkout","message":"card declined"}
{"secondsAgo":600,"repeat":40,"fields":{"level":"error","service":"checkout"}}
An event happens now unless written in the second form, where secondsAgo
places it in the past and repeat counts it more than once. An event older
than the rule's window is left out, exactly as it would be in production, so a
test can prove the window is right too.
Tests run against the rule's own query and condition: the filter, any
| where, | eval or | dedup stages, the group-by fields, an error rate's
scope query, and a sum's field. They read only the sample events, never your
stored data, so running them costs nothing. A rule that uses | json,
| extract, | lookup or | askObi, or one on the audit log, cannot be
tested yet, and the test says so rather than passing.
Tests also guard every edit. When you change what a rule measures (its query, condition, threshold, window or group-by), the change is saved only if every test still passes. You can still save a new test that fails, so you can write the test first and then fix the rule.
From CI, send a rule and its tests to the test endpoint. It answers with each test's result and stores nothing:
curl https://api.obistack.com/v1/alerts/test \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "level=error service=payments",
"conditionType": "log_volume",
"conditionOperator": ">",
"conditionThreshold": 50,
"windowSeconds": 300,
"testCases": [
{
"name": "a burst of errors pages",
"expect": "fires",
"events": [{ "secondsAgo": 30, "repeat": 51, "fields": { "level": "error", "service": "payments" } }]
},
{
"name": "errors from another service do not",
"expect": "does_not_fire",
"events": [{ "repeat": 80, "fields": { "level": "error", "service": "search" } }]
}
]
}'
Send the same testCases list when you create a rule or PATCH it to keep
the tests with the rule. A create or edit whose tests fail is refused with
422 alert_rule_tests_failed, so a pipeline stops before a broken rule
reaches production.
Managing rules from CI
Every screen described above is backed by a public endpoint, so alert rules can be kept in version control and applied from a pipeline rather than clicked into existence by one person:
# List the rules this workspace has
curl https://api.obistack.com/v1/alerts/rules \
-H "Authorization: Bearer <your API key>"
# Create one. POST always creates - to change an existing rule,
# PATCH /v1/alerts/rules/<id> instead.
curl https://api.obistack.com/v1/alerts/rules \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"name": "payments-high-error-rate",
"query": "level=error service=payments",
"conditionType": "log_volume",
"conditionOperator": ">",
"conditionThreshold": 50,
"windowSeconds": 300,
"intervalSeconds": 60
}'
conditionType is one of log_volume, error_rate, field_sum, or
pattern_match, and conditionOperator is one of >, >=, <, <=, or
==. Both windowSeconds and intervalSeconds are integers between 10 and
86400.
A field_sum rule compares the total of one numeric field instead of a count
of events. Name the field in valueField: a stored field, or a column the
rule's own query creates with | eval. An event without the field, or with a
value that is not a number, adds nothing to the total. For example, this rule
fires when the bytes sent by the checkout service add up to more than
5,000,000,000 in an hour:
curl https://api.obistack.com/v1/alerts/rules \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"name": "checkout-egress",
"query": "service.name=checkout bytes=*",
"conditionType": "field_sum",
"valueField": "bytes",
"conditionOperator": ">",
"conditionThreshold": 5000000000,
"windowSeconds": 3600,
"intervalSeconds": 300
}'
See the API reference for the full alert rule, silence, health, and incident endpoints, and creating an alert from an external system for raising one from a tool we do not integrate with directly.
Tenant Isolation & Data Boundaries
An alert rule, its firing history, and every incident it opens are scoped to the workspace whose authenticated session created them - never from an id in the request body. Evaluation runs server-side against that workspace's own data only, and a notification destination (a Slack webhook URL, a PagerDuty key) is stored but never echoed back once saved. See Tenant Isolation for the full cross-feature model.