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 '"{\n \"budgetingMethod\": \"occurrences\",\n \"description\": \"Availability of my web service measured by successful HTTP responses\",\n \"indicator\": {\n \"params\": {\n \"filter\": \"field.environment : \\\"production\\\" and service.name : \\\"my-service\\\"\",\n \"good\": \"request.status_code : \\\"2xx\\\"\",\n \"index\": \"logs-*\",\n \"timestampField\": \"@timestamp\",\n \"total\": \"request.status_code : *\"\n },\n \"type\": \"sli.kql.custom\"\n },\n \"name\": \"My Service Availability\",\n \"objective\": {\n \"target\": 0.99\n },\n \"settings\": {\n \"frequency\": \"5m\",\n \"syncDelay\": \"5m\"\n },\n \"tags\": [\n \"production\",\n \"web-service\"\n ],\n \"timeWindow\": {\n \"duration\": \"30d\",\n \"type\": \"rolling\"\n }\n}"'
Request example
{
"budgetingMethod": "occurrences",
"description": "Availability of my web service measured by successful HTTP responses",
"indicator": {
"params": {
"filter": "field.environment : \"production\" and service.name : \"my-service\"",
"good": "request.status_code : \"2xx\"",
"index": "logs-*",
"timestampField": "@timestamp",
"total": "request.status_code : *"
},
"type": "sli.kql.custom"
},
"name": "My Service Availability",
"objective": {
"target": 0.99
},
"settings": {
"frequency": "5m",
"syncDelay": "5m"
},
"tags": [
"production",
"web-service"
],
"timeWindow": {
"duration": "30d",
"type": "rolling"
}
}
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
}