Create an SLO Beta

POST /s/{spaceId}/api/observability/slos

You must have all privileges for the SLOs feature in the Observability section of the Kibana feature privileges.

Headers

  • kbn-xsrf string Required

    Cross-site request forgery protection

Path parameters

  • spaceId string Required

    An identifier for the space. If /s/ and the identifier are omitted from the path, the default space is used.

application/json; Elastic-Api-Version=2023-10-31

Body Required

The create SLO API request body varies depending on the type of indicator, time window and budgeting method.

  • budgetingMethod string Required

    The budgeting method to use when computing the rollup data.

    Values are occurrences or timeslices.

  • description string Required

    A description for the SLO.

  • groupBy string

    optional group by field to use to generate an SLO per distinct value

  • id string

    A optional and unique identifier for the SLO. Must be between 8 and 36 chars

  • indicator object Required

    One of:
  • name string Required

    A name for the SLO.

  • objective object Required

    Defines properties for the SLO objective

    Hide objective attributes Show objective attributes object
    • target number Required

      the target objective between 0 and 1 excluded

      Minimum value is 0, maximum value is 100.

    • the target objective for each slice when using a timeslices budgeting method

      Minimum value is 0, maximum value is 100.

    • the duration of each slice when using a timeslices budgeting method, as {duraton}{unit}

  • settings object

    Defines properties for SLO settings.

    Hide settings attributes Show settings attributes object
    • Configure how often the transform runs, default 1m

      Default value is 1m.

    • Prevents the transform from backfilling data when it starts.

      Default value is false.

    • The synch delay to apply to the transform. Default 1m

      Default value is 1m.

  • tags array[string]

    List of tags

  • timeWindow object Required

    Defines properties for the SLO time window

    Hide timeWindow attributes Show timeWindow attributes object
    • duration string Required

      the duration formatted as {duration}{unit}. Accepted values for rolling: 7d, 30d, 90d. Accepted values for calendar aligned: 1w (weekly) or 1M (monthly)

    • type string Required

      Indicates weither the time window is a rolling or a calendar aligned time window.

      Values are rolling or calendarAligned.

Responses

  • 200 application/json; Elastic-Api-Version=2023-10-31

    Successful request

    Hide response attribute Show response attribute object
    • id string Required
  • 400 application/json; Elastic-Api-Version=2023-10-31

    Bad request

    Hide response attributes Show response attributes object
  • 401 application/json; Elastic-Api-Version=2023-10-31

    Unauthorized response

    Hide response attributes Show response attributes object
  • 403 application/json; Elastic-Api-Version=2023-10-31

    Unauthorized response

    Hide response attributes Show response attributes object
  • 409 application/json; Elastic-Api-Version=2023-10-31

    Conflict - The SLO id already exists

    Hide response attributes Show response attributes object
POST /s/{spaceId}/api/observability/slos
curl \
 -X POST https://localhost:5601/s/default/api/observability/slos \
 -H "Content-Type: application/json; Elastic-Api-Version=2023-10-31" \
 -H "kbn-xsrf: string"
Request examples
# Headers
kbn-xsrf: string

# Payload
{
  "budgetingMethod": "occurrences",
  "description": "string",
  "groupBy": "some.field",
  "id": "my-super-slo-id",
  "indicator": {
    "params": {
      "dataViewId": "03b80ab3-003d-498b-881c-3beedbaf1162",
      "filter": "field.environment : \"production\" and service.name : \"my-service\"",
      "good": "request.latency <= 150 and request.status_code : \"2xx\"",
      "index": "my-service-*",
      "timestampField": "timestamp",
      "total": "field.environment : \"production\" and service.name : \"my-service\""
    },
    "type": "sli.kql.custom"
  },
  "name": "string",
  "objective": {
    "target": 0.99,
    "timesliceTarget": 0.995,
    "timesliceWindow": "5m"
  },
  "settings": {
    "frequency": "5m",
    "preventInitialBackfill": true,
    "syncDelay": "5m"
  },
  "tags": [
    "string"
  ],
  "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: [...]",
  "statusCode": 400
}
Response examples (401)
{
  "error": "Unauthorized",
  "message": "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [elastics] for REST request [/_security/_authenticate]]: unable to authenticate user [elastics] for REST request [/_security/_authenticate]",
  "statusCode": 401
}
Response examples (403)
{
  "error": "Unauthorized",
  "message": "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [elastics] for REST request [/_security/_authenticate]]: unable to authenticate user [elastics] for REST request [/_security/_authenticate]",
  "statusCode": 403
}
Response examples (409)
{
  "error": "Conflict",
  "message": "SLO [d077e940-1515-11ee-9c50-9d096392f520] already exists",
  "statusCode": 409
}