Create a monitor
Create a monitor
Turn a query into an alert.
The query must return a single numeric column, optionally binned over time. See monitors for how each type evaluates.
Bin to the evaluation window
If
interval_minutes is 5, bin to 5m. A 1m bin evaluated every 5 minutes fires on whichever minute happens to be worst, which is how monitors get a reputation for flapping.POST
/v1/monitorsBody parameters
namestringrequiredShown in notifications. Make it read as a sentence on a pager.
typeenumrequiredEvaluation strategy.
thresholdanomalymatch
aplstringrequiredThe LSQL to evaluate.
operatorenumThreshold monitors only.
abovebelowabove_or_equalbelow_or_equal
thresholdnumberThreshold monitors only.
tolerancenumberAnomaly monitors only — standard deviations from the baseline.
interval_minutesintegerdefault 5Evaluation frequency. Minimum 1.
range_minutesintegerdefault 5Window each evaluation looks at.
notifiersarrayrequiredNotifier ids to route to.
resolve_after_minutesintegerdefault 15Consecutive healthy minutes before auto-resolving.
curl -X POST https://api.logstreem.com/v1/monitors \
-H "Authorization: Bearer $LOGSTREEM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Checkout 5xx rate","type":"threshold","apl":"['api-gateway-prod']\n| where service == \"checkout\" and status >= 500\n| summarize count() by bin(_time, 5m)","operator":"above","threshold":25,"interval_minutes":5,"notifiers":["ntf_1d7e4b3a09c2f856d4a1"]}'Responses
201Created
{
"object": "monitor",
"id": "mon_4a81e0c3f6a5b2d1e0c9",
"name": "Checkout 5xx rate",
"type": "threshold",
"dataset": "api-gateway-prod",
"apl": "['api-gateway-prod']\n| where status >= 500\n| summarize count() by bin(_time, 5m)",
"operator": "above",
"threshold": 25,
"interval_minutes": 5,
"state": "ok",
"notifiers": ["ntf_1d7e4b3a09c2f856d4a1"],
"created_at": "2026-08-02T09:41:00.000Z"
}401Unauthorized
{
"error": {
"type": "authentication_error",
"code": "missing_token",
"message": "No API token provided.",
"doc_url": "https://logstreem.com/docs/errors#missing_token",
"request_id": "req_9f3c2a7b41de08c5b2e6"
}
}Try itsandbox