You must have all privileges for the SLOs feature in the Observability section of the Kibana feature privileges.
Path parameters
-
An identifier for the space. If
/s/and the identifier are omitted from the path, the default space is used.
Body
Required
-
Links to related assets for the SLO
-
The budgeting method to use when computing the rollup data.
Values are
occurrencesortimeslices. -
A description for the SLO.
-
A optional and unique identifier for the SLO. Must be between 8 and 36 chars
-
A name for the SLO.
-
Defines properties for the SLO objective
-
Defines properties for SLO settings.
-
Defines properties for the SLO time window
POST
/s/{spaceId}/api/observability/slos
curl \
--request POST 'https://localhost:5601/s/default/api/observability/slos' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--header "kbn-xsrf: string" \
--data '{"name":"My Service Availability","tags":["production","web-service"],"settings":{"frequency":"5m","syncDelay":"5m"},"indicator":{"type":"sli.kql.custom","params":{"good":"request.status_code : \"2xx\"","index":"logs-*","total":"request.status_code : *","filter":"field.environment : \"production\" and service.name : \"my-service\"","timestampField":"@timestamp"}},"objective":{"target":0.99},"timeWindow":{"type":"rolling","duration":"30d"},"description":"Availability of my web service measured by successful HTTP responses","budgetingMethod":"occurrences"}'
Request example
{
"name": "My Service Availability",
"tags": [
"production",
"web-service"
],
"settings": {
"frequency": "5m",
"syncDelay": "5m"
},
"indicator": {
"type": "sli.kql.custom",
"params": {
"good": "request.status_code : \"2xx\"",
"index": "logs-*",
"total": "request.status_code : *",
"filter": "field.environment : \"production\" and service.name : \"my-service\"",
"timestampField": "@timestamp"
}
},
"objective": {
"target": 0.99
},
"timeWindow": {
"type": "rolling",
"duration": "30d"
},
"description": "Availability of my web service measured by successful HTTP responses",
"budgetingMethod": "occurrences"
}
Response examples (200)
{
"id": "8853df00-ae2e-11ed-90af-09bb6422b258"
}
Response examples (400)
{
"error": "Bad Request",
"message": "Invalid value 'foo' supplied to: indicator/type",
"statusCode": 400
}
Response examples (401)
{
"error": "Unauthorized",
"message": "security_exception: unable to authenticate user for REST request [/api/observability/slos]",
"statusCode": 401
}
Response examples (403)
{
"error": "Forbidden",
"message": "security_exception: action [slo_write] is unauthorized for user",
"statusCode": 403
}
Response examples (409)
{
"error": "Conflict",
"message": "SLO [d077e940-1515-11ee-9c50-9d096392f520] already exists",
"statusCode": 409
}