All Products
Search
Document Center

Simple Log Service:GetMLServiceResults

Last Updated:Oct 09, 2025

Alibaba Cloud Simple Log Service (SLS) provides intelligent analysis for data such as logs, metrics, and traces. You can call models to obtain analysis results directly. Its main features include Named Entity Recognition (NER) for log data, anomaly detection for time series data, and root cause analysis for high-latency trace spans.

Operation description

This API endpoint is available only in the China (Shanghai) and Singapore regions. The following basic permissions are required:

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "log:Get*"
            ],
            "Resource": [
                "acs:log:*:*:mlservice/sls_builtin_*"
            ],
            "Effect": "Allow"
        }
    ]
}

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /ml/service/{serviceName}/analysis HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

serviceName

string

No

The service name.

Valid values:

  • sls_builtin_service_trace_rca :

    The service for analyzing high-latency trace requests.

  • sls_builtin_service_log_struct :

    The service for LogNER.

  • sls_builtin_service_metric_anomaly :

    The service for single-dimension time series anomaly detection.

sls_builtin_service_log_struct

allowBuiltin

boolean

No

  • true: The request can use a built-in system service.

  • false: The request cannot use a built-in system service.

Valid values:

  • true :

    The request can use a built-in system service.

  • false :

    The request cannot use a built-in system service.

true

version

string

No

The version number of the algorithm. Different versions correspond to different algorithms.

v1

body MLServiceAnalysisParam

No

The request struct.

Valid values:

  • others :

    The content varies based on the value of serviceName.

The request parameters vary depending on the service. The details are as follows:

Named Entity Recognition for logs (sls_builtin_service_log_struct)

Details of body.parameter

{
  "is_struct": "true",
  "use_gpu": "true/false",
  "max_fields": "1"
}
  • If is_struct is true, the log is in JSON format. Currently, you can only set this parameter to true.

  • use_gpu specifies whether to use GPU resources.

  • max_fields specifies the maximum number of fields to analyze when the log is in JSON format. By default, one field is analyzed.

Details of body.input

[
  {
    "{column_name}": "{column_value}"
  }
]

The input is an array of JSON objects, where:

  • column_name is the name of a field in the JSON-formatted log.

  • column_value is the value of the field in the JSON-formatted log.

Time series anomaly detection (sls_builtin_service_metric_anomaly)

Details of body.parameter

{
  "isOrdered": "true/false",
  "keys": "[]",
  "timeColumnName": "",
  "analysisColumnNames": "[]",
  "interval": "-1"
}
  • isOrdered specifies whether the input data is ordered. Set this parameter to true if the input time series is sorted in ascending order by time. Otherwise, set it to false.

  • interval specifies the interval of the time series in seconds. For example, if the series has one data point per minute, set this parameter to 60. If you are unsure of the interval, set this parameter to -1.

  • timeColumnName specifies the name of the time dimension in the input series.

  • analysisColumnNames specifies the names of the numerical feature dimensions to be analyzed in the input series. This is an array that must be serialized into a string.

  • keys specifies the names of all columns in the input data. This is an array that must be serialized into a string.

Details of body.input

[
  {
    "{column_name}": "{column_value}"
  }
]

The input is an array, where:

  • column_name is the name of a field in the series.

  • column_value is the value of the field. If {column_name} is the same as {timeColumnName}, the value is a UNIX timestamp in seconds.

High-latency trace detection (sls_builtin_service_trace_rca)

Details of body.parameter

{
  "project": "",
  "logstore": "",
  "endpoint": "",
  "role_arn": ""
}
  • project specifies the name of the project in SLS where the trace data is stored.

  • logstore specifies the name of the Logstore in SLS where the trace data is stored.

  • endpoint specifies the endpoint of the region where the project is located. You must use an Internet endpoint. Internal endpoints in the same region cannot be accessed.

  • role_arn specifies the ARN of the role that is granted permissions to the resource. You must use the ARN of an ETLRole or AuditRole.

Details of body.input

[
  {
    "service": "",
    "name": "",
    "from_ts_sec": "",
    "to_ts_sec": "",
    "slo_ts_micro": "",
    "batch_id": "",
    "trace_ids": "[]"
  }
]

The input is an array with a length of 1. The parameters are described as follows:

  • service specifies the service name for one or more TraceIDs to be diagnosed. You can retrieve this from the Logstore.

  • name specifies the service name for one or more TraceIDs to be diagnosed. You can retrieve this from the Logstore.

  • from_ts_sec specifies the start timestamp for the analysis, in seconds.

  • to_ts_sec specifies the end timestamp for the analysis, in seconds.

  • batch_id specifies the name for the current batch of TraceIDs to be analyzed.

  • trace_ids specifies the list of trace_ids for the current request. This must be a JSON-serialized string.

Response elements

Element

Type

Description

Example

object

The returned struct.

Valid values:

  • 无 :

    None

status

object

The status of the task.

Valid values:

  • 无 :

    None

string

By default, this parameter is empty, and tasks in all statuses are returned. Supported statuses are success, fail, and running.

Valid values:

  • 无 :

    None

200

data

array<object>

The returned data.

object

The dataset struct.

string

The returned result.

{'marker': ''}

The return value varies depending on the service. The details are as follows:

Named Entity Recognition for logs (sls_builtin_service_log_struct)

Details of data

[
  {
    "{column_name}": "{column_value}"
  }
]

Each JSON object in the output corresponds to a JSON object in the input log, where:

  • column_name is the name of an analyzed field in the JSON-formatted log. A maximum of max_fields fields are analyzed.

  • column_value is the value of the analyzed field. The NER result in the field value is enclosed in <ml_ner_${ner_type}></ml_ner_${ner_type}> tags, where ${ner_type} is the specific NER type.

Time series anomaly detection (sls_builtin_service_metric_anomaly)

Details of data

[
  {
    "start": "",
    "end": "",
    "label": ""
  }
]
  • start specifies the start time of the detected anomaly interval.

  • end specifies the end time of the detected anomaly interval.

  • label specifies the type of anomaly detected in the current interval.
    • SPIKE_UP_TYPE

    • SPIKE_DOWN_TYPE

    • TREND_UP_TYPE

    • TREND_DOWN_TYPE

    • MEANSHIFT_UPWARD_TYPE

    • MEANSHIFT_DOWNWARD_TYPE

High-latency trace detection (sls_builtin_service_trace_rca)

Details of data

[
  {
    "traceID": "",
    "service": "",
    "name": "",
    "rootCauses": "[{}]"
  }
]
  • traceID specifies the ID of the trace that was analyzed.

  • service specifies the service name of the root node of the trace.

  • name specifies the name of the root node of the trace.

  • rootCauses specifies the list of spans that caused the high latency in the trace. This is a serialized string. When deserialized, the structure of this field is as follows:

[
  {
    "spanID": "",
    "service": "",
    "name": "",
    "host": "xxxx",
    "predicateDuration": 10
  }
]

Examples

Success response

JSON format

{
  "status": {
    "key": "200"
  },
  "data": [
    {
      "key": "{'marker': ''}"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.