Monitors evaluate a SQL API query on a schedule. Cloudflare sends a notification when the query result meets your detection criteria. You can create monitors from the Cloudflare dashboard under Alerts > Monitors.
The datasets available to monitors depend on your plan and permissions. The dashboard only lists datasets available to the selected account or zone. For more information about dataset scopes and sampling, refer to SQL API datasets.
- Go to Alerts > Monitors in the Cloudflare dashboard.
- Select Create a Monitor.
- Choose a detection method: Threshold, Anomaly detection, or SLO.
- Configure the query using the visual builder or enter custom SQL.
- Set the detection parameters (threshold value, sensitivity, or SLO target).
- Name the monitor and add a description.
- Add one or more delivery destinations (email, webhook, or PagerDuty).
- Select Create.
Each monitor has the following details:
| Option | Required | Description |
|---|---|---|
| Name | Yes | Identifies the monitor in notifications and the Cloudflare dashboard. |
| Description | No | Records additional context about the monitor. |
| Destination | Yes | Sends notifications to at least one email address, webhook, or PagerDuty service. |
You can add up to 20 email recipients. All plans can use webhooks. PagerDuty requires a Business or higher zone.
Use the query builder or enter custom SQL. The query builder supports these options:
| Option | Description |
|---|---|
| Dataset scope | Limits dataset selection to account-level datasets or datasets for one zone. |
| Dataset | Selects one dataset available within the dataset scope. |
| Metric | Applies COUNT or a supported aggregate function to a numeric field. The builder returns the result as value. |
| Time range | In Manual mode, sets a fixed data window relative to each evaluation and adds the timestamp bounds. |
| Filters | Restricts rows by field value. Available operators depend on the field data type. Multiple filters use AND. |
For adaptively sampled datasets, the builder uses APPROX_MIN and APPROX_MAX instead of MIN and MAX. The SQL API automatically applies sample weights to COUNT, SUM, and AVG.
A custom SQL query must meet these requirements:
- Return one numeric value in a column named
value. - Read one schema-qualified SQL API dataset.
- Include an account or zone filter.
- Include a lower timestamp bound when using Manual time-range mode.
- Use the supported SQL syntax.
- Omit a trailing semicolon.
Custom SQL supports two time-range modes:
- Automatic (recommended): Omit the timestamp filter. When the monitor runs, Cloudflare supplies a time range ending at the evaluation time and spanning the execution interval.
- Manual: Add a fixed time range to the SQL query. Relative ranges end at the evaluation time.
For example, this query returns the number of server errors during the previous five minutes:
SELECT COUNT(*) AS value
FROM events.httpRequests
WHERE accountTag = '<ACCOUNT_TAG>'
AND timestamp >= NOW() - INTERVAL '5' MINUTE
AND edgeResponseStatus >= 500Monitors validate the query before saving. Query errors identify unsupported syntax, unavailable datasets or fields, and invalid scope. For SQL API query limits, refer to Limits.
Choose how Cloudflare evaluates the query result:
| Method | Description |
|---|---|
| Threshold | Compares the query result with a fixed numeric value. |
| Anomaly detection | Compares the query result with its historical baseline and detects spikes and/or drops. |
| Service-level objective | Compares the ratio of successful events to total events with a service-level objective (SLO) target. |
A threshold monitor compares the query result with a fixed value. It supports these options:
| Option | Description |
|---|---|
| Query | Produces the numeric value to evaluate. |
| Evaluation window | Sets the data window for each evaluation. You can select a preset or enter a custom duration. |
| Comparison operator | Compares the result with the threshold. Supported operators are <, >, <=, >=, ==, and !=. |
| Threshold | Sets the numeric value used by the comparison. |
Anomaly detection calculates the number of standard deviations between the current result and its historical baseline. It supports these options:
| Option | Description |
|---|---|
| Query | Produces the numeric value to evaluate. |
| Evaluation window | Sets the current data window. You can select a preset or enter a custom duration. |
| Baseline window | Sets the historical comparison window. The value must be at least six times the evaluation window and no more than 24h. |
| Alert on | Detects spikes, drops, or both spikes and drops. |
| Sensitivity | Sets the z-score threshold. Lower values detect smaller changes. You can select a preset or enter a custom value. |
| Minimum event count | Optionally suppresses alerts for low-volume evaluation windows. |
New anomaly detection monitors require at least 30 minutes of historical data before they can trigger.
An SLO monitor calculates the successful-event percentage from bad and total event counts. Both queries must return a numeric column named value. It supports these options:
| Option | Description |
|---|---|
| Bad events query | Counts events that do not meet your success criteria. |
| Total events query | Counts all events in the same population as the bad events query. |
| Short window | Measures the successful-event percentage over a short period so the monitor reacts and resolves quickly. |
| Long window | Measures the successful-event percentage over a longer period so brief failures do not trigger the monitor. |
| SLO target | Triggers when (1 - bad events / total events) × 100 is below this value for both windows. You can select a preset or customize it. |
| Minimum event count | Optionally suppresses alerts for low-volume evaluation windows. |
Use equivalent filters in both queries. The bad events query should represent a subset of the total events query.
Monitors support two independent frequency settings:
| Option | Description |
|---|---|
| Execution interval | Controls how often Cloudflare runs the query. Leave this option at Default to use the fastest interval supported by the dataset. You can select a preset or enter a custom duration of at least one minute. |
| Repeat notification interval | Controls how often Cloudflare sends another notification while the monitor remains active. You can select a preset or enter a custom duration from one minute through 168h. The default is 1h. |
Most SQL API datasets support a one-minute execution interval. Log Explorer datasets support a minimum execution interval of 10 minutes. Cloudflare rejects an interval shorter than the selected dataset supports.
The query preview validates and charts an approximation of the signal before you save. Select a preview range of up to 7 days to inspect how the monitor might behave. The data shown in the preview may differ from the data evaluated by a monitor, including historical evaluations.
Threshold previews show the configured threshold. SLO previews show the calculated percentage and target. A query that returns no rows produces no signal and cannot trigger the monitor for that evaluation.