Types of alerts
You can create alerts from a saved search, directly in Chart Explorer, or from a chart on a saved dashboard. Search alerts count matching events, while chart alerts evaluate the values calculated by a chart.Search alerts
Search alerts allow you to trigger notifications based on the results of a saved search. They help you detect when specific events or patterns occur more (or less) frequently than expected. An alert is triggered when the count of matching results within a defined time window either exceeds or falls below a specified threshold. To create a search alert: For an alert to be created for a search, the search must be saved. You can either create the alert for an existing saved search or save the search during the alert creation process. In the example below, we assume the search isn’t saved.1
Open alert creation dialog
Start by entering a search and clicking the
Alerts button in the top-right corner of the Search page.2
Create the alert
From the alert creation panel, you can:
- Assign a name to the saved search associated with the alert.
- Choose a comparison operator, a matching-event count, and a time window. For example, trigger when at least 10 matching events appear within 5 minutes.
- Specify a
grouped byvalue. This allows the search to be subject to an aggregation, e.g.,ServiceName, thus allowing multiple alerts to be triggered off the same search. - Choose a notification destination, such as email or a webhook. You can add a new webhook directly from this view. See Adding a webhook for details.
Chart Explorer alerts
Create an alert directly in Chart Explorer to monitor a chart without adding it to a dashboard.1
Build the chart
Select Chart explorer in the sidebar and use the Time Series chart type. Choose a data source and configure the aggregation, filters, and grouping you want to monitor. For example, count error logs and group by
ServiceName to evaluate each service separately.Select Run and check the results before configuring the alert.2
Configure the alert
Select Add alert. For a Static threshold alert, configure:
- Trigger when value: choose the comparison operator and threshold.
- over: choose the evaluation time window, such as 5 minutes.
- Name: give the alert a descriptive name.
- Send to: choose an email or webhook destination. To create a webhook, see Adding a webhook.
3
Create and manage the alert
Select Create alert to save it. You do not need to save a dashboard first.Open Alerts in the sidebar and select the alert to view its details, including its condition, notification destination, chart, and evaluation history.
Dashboard chart alerts
Dashboard alerts extend alerting to charts. You can create a chart-based alert directly from a saved dashboard, powered by full SQL aggregations and ClickHouse functions for advanced calculations. When a metric crosses a defined threshold, an alert triggers automatically, allowing you to monitor KPIs, latencies, or other key metrics over time.For an alert to be created for a visualization on a dashboard, the dashboard must be saved.
1
Open the chart edit dialog
Click the Add alert bell icon in the chart toolbar to open the chart edit dialog.
2
Add the alert
Select Add alert.
3
Define the alert conditions
Define the condition (
>=, >, <=, <, =, !=, <= x >=, > or <), threshold, duration, and webhook. The duration here will also dictate how often the alert is triggered.You can add a new webhook directly from this view. See Adding a webhook for details.Adding a webhook
During alert creation, you can either use an existing webhook or create one. Once created, the webhook will be available for reuse across other alerts. A webhook can be created for different service types, including Slack and PagerDuty, as well as generic targets. In the alert panel, select Add New Incoming Webhook to create a notification destination. This opens the webhook creation dialog, where you can create a new webhook: A webhook name is required, while descriptions are optional. Other settings that must be completed depend on the service type. See Service type integrations for supported notification services.Service type integrations
Alerts integrate out of the box with the following service types:- Slack: send notifications directly to a channel via either a webhook or API.
- PagerDuty: route incidents for on-call teams via the PagerDuty API.
- incident.io: send alerts to incident.io.
- Generic: connect alerts to any custom system or workflow via a generic webhook.
ClickHouse Cloud only integrationsThe Slack API and PagerDuty integrations are only supported in ClickHouse Cloud.
- Webhook URL. For example:
https://hooks.slack.com/services/<unique_path>. See the Slack documentation for further details.
- Slack bot token. See the Slack documentation for further details.
- PagerDuty integration key. See the PagerDuty documentation for further details.
- Webhook URL
- Webhook headers (optional)
- Webhook body (optional). The body currently supports the template variables
{{title}},{{body}}, and{{link}}.
Managing alerts
Select Alerts in the left sidebar to manage your alerts. You can search by name and filter by state, source, or type. This view also displays the alert evaluation history. Alerts are evaluated on a recurring time interval (defined by the period/duration set during alert creation). During each evaluation, the service queries your data to check whether the alert condition is met:- Red bar: The threshold condition was met during this evaluation and the alert fired (notification sent)
- Green bar: The alert was evaluated but the threshold condition wasn’t met (no notification sent)
Deleting an alert
To remove a chart alert, open the chart editor and select Edit alert. Click the trash icon in the top-right corner of the alert panel.SQL-based chart alerts
SQL-based chart alerts let you write arbitrary ClickHouse SQL to define alert conditions. This gives you full control over filtering, aggregation, and math — anything you can express in SQL can become an alert.Supported chart types
SQL-based alerts are supported on three chart display types:
Other SQL-based chart types (Table, Pie, Heatmap, etc.) do not support alerts.
Creating a SQL alert
To create an alert on a SQL-based chart:1
Create or open a SQL-based chart on a dashboard
From a saved dashboard, either create a new chart with the SQL chart mode, or open an existing SQL-based chart for editing.Choose Line, Stacked Bar, or Number as the display type.
2
Add the alert
Select Add alert from the alert section of the chart editor. Configure:
- Threshold type:
>=(greater than or equal),>(greater than),<=(less than or equal),<(less than),=(equal),!=(not equal),≤ x ≤(between), or< or >(outside) - Threshold value: The numeric value to compare against
- Interval: How often the alert is evaluated (5m, 15m, 30m, 1h, 6h, 12h, or 1d). This also defines the time window for each evaluation.
- Webhook: The notification channel to use when the alert fires. See Adding a webhook.
3
Save the dashboard
Save the dashboard to activate the alert. The alert will begin evaluating on the configured interval.
How query results are interpreted
The alert system inspects the columns returned by your SQL query to determine what to compare against the threshold.- Value column: The last numeric column in your
SELECTclause is used as the alert value. If your query returns multiple numeric columns (e.g.,count, avg_latency, p99_latency), only the last one (p99_latency) is compared to the threshold. - Timestamp column: For time-series charts (Line and Stacked Bar), the system identifies the Date/DateTime column in your results as the time bucket (i.e. the x-axis on a time-series chart). The value column for each time bucket is evaluated against the threshold independently, and if the value for any time bucket breaches the configured threshold, the alert will trigger.
- Group columns: Any non-numeric, non-timestamp columns (e.g.,
ServiceName,Environment) are treated as grouping dimensions. When groups are present, each unique combination of group values is tracked and alerted on separately. The service will send an alert for each group with a value that breaches the configured threshold. Groups are only available for time-series charts.
Query parameters and macros
SQL alert queries support template parameters and macros that are automatically replaced at evaluation time. These are the same parameters and macros available when building a SQL-based chart.Required and Recommended Parameters
Queries used for line or stacked bar chart alerts must include an interval parameter or macro ({intervalSeconds:Int64}, {intervalMilliseconds:Int64}, $__timeInterval(col), or $__timeInterval_ms(col)). During alert execution, it will be replaced with the alert’s configured period.
Queries used for alerts should include a time range filter ({startDateMilliseconds:Int64} and {endDateMilliseconds:Int64}, or $__timeFilter(col), etc.). Regardless of whether a time range filter is present in the query, the alert query will run on the alert’s configured period. If there is no time range filter, then the query will read the entire time range available in the source table during each execution.
Example alert queries
Error rate per service (time-series)
Alert when any service has an error rate of at least 5%, with more than 10 requests in the alert period to avoid noisy alerts on low-traffic services.>= 5 (fires when error rate reaches 5%)
In this query, ServiceName is a non-numeric, non-timestamp column, so each service is tracked as a separate alert group. The alert fires independently per service.
Anomaly detection with lagging average (time-series)
Alert on excess error counts that exceed a rolling average by more than two standard deviations. This catches spikes relative to recent baseline behavior rather than a fixed threshold.> 0 (fires when excess errors above the rolling baseline are detected)
Note that the query fetches 30 intervals before the start of the date range to seed the rolling window calculations, then filters the final output to only the evaluation window.
Common alert scenarios
Here are a few common alert scenarios you can configure: Errors: We recommend setting up alerts for the defaultAll Error Events and HTTP Status >= 400 saved searches to be notified when
excess errors occur.
Slow Operations: You can set up a search for slow operations (e.g.,
duration:>5000) and then alert when there are too many slow operations
occurring.
User Events: You can also set up alerts for customer-facing teams to be
notified when new users sign up or a critical user action is performed.