kind is scheduled, real_time, or anomaly. Creating and changing rules requires
alerts.manage. See Alerting for detector-specific fields.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
{
"name": "High error rate",
"description": "More than 100 errors in one minute",
"enabled": true,
"kind": "scheduled",
"query": {
"language": "sql",
"statement": "SELECT count(*) AS c FROM app WHERE level = 'error'",
"period_secs": 60,
"stream": { "name": "app", "stream_type": "logs" }
},
"trigger": {
"operator": "gt",
"threshold": 100,
"for_periods": 1,
"silence_secs": 300
},
"thresholds": [],
"severity": "critical",
"escalation_policy_id": "<policy-id>",
"labels": { "team": "checkout" },
"annotations": {}
}
Create an alert rule.
{
"name": "High error rate",
"description": "More than 100 errors in one minute",
"enabled": true,
"kind": "scheduled",
"query": {
"language": "sql",
"statement": "SELECT count(*) AS c FROM app WHERE level = 'error'",
"period_secs": 60,
"stream": { "name": "app", "stream_type": "logs" }
},
"trigger": {
"operator": "gt",
"threshold": 100,
"for_periods": 1,
"silence_secs": 300
},
"thresholds": [],
"severity": "critical",
"escalation_policy_id": "<policy-id>",
"labels": { "team": "checkout" },
"annotations": {}
}
POST /api/v1/alerts/rules
kind is scheduled, real_time, or anomaly. Creating and changing rules requires
alerts.manage. See Alerting for detector-specific fields.
{
"name": "High error rate",
"description": "More than 100 errors in one minute",
"enabled": true,
"kind": "scheduled",
"query": {
"language": "sql",
"statement": "SELECT count(*) AS c FROM app WHERE level = 'error'",
"period_secs": 60,
"stream": { "name": "app", "stream_type": "logs" }
},
"trigger": {
"operator": "gt",
"threshold": 100,
"for_periods": 1,
"silence_secs": 300
},
"thresholds": [],
"severity": "critical",
"escalation_policy_id": "<policy-id>",
"labels": { "team": "checkout" },
"annotations": {}
}
Was this page helpful?