GetMLServiceResults
Provides intelligent analysis capabilities for basic data such as logs, metrics, and traces on the Simple Log Service platform. Users can invoke relevant models to directly obtain analysis results. The supported scenarios include named entity recognition (NER) for log data, outlier detection for time series data, and root cause analysis of spans for high-latency trace data.
Operation description
The endpoint for this API operation can only be China (Shanghai) or Singapore. The following basic permissions are required:
{
"Version": "1",
"Statement": [
{
"Action": [
"log:Get*"
],
"Resource": [
"acs:log:*:*:mlservice/sls_builtin_*"
],
"Effect": "Allow"
}
]
}
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
log:GetMLServiceResults |
list |
*All Resource
|
None | None |
Request syntax
POST /ml/service/{serviceName}/analysis HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| serviceName |
string |
No |
The service name. Valid values:
|
sls_builtin_service_log_struct |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| allowBuiltin |
boolean |
No |
Specifies whether the request is allowed to use system built-in services. Valid values:
Valid values:
|
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:
|
The request parameters vary based on the scenario. Details are as follows:
Log content named entity recognition (sls_builtin_service_log_struct)
Parameters related to body.parameter
{
"is_struct": "true",
"use_gpu": "true/false",
"max_fields": "1"
}
If is_struct is set to true, it indicates that the log format is JSON. Currently, only true is supported.
use_gpu specifies whether to use GPU resources.
max_fields specifies the maximum number of fields to be analyzed when the log format is JSON. By default, only one field is analyzed.
Parameters related to body.input
[
{
"{column_name}": "{column_value}"
}
]
The input content is a JSON array, where:
column_name indicates the name of a field in the JSON log.
column_value indicates the value of a field in the JSON log.
Time series outlier detection (sls_builtin_service_metric_anomaly)
Parameters related to body.parameter
{
"isOrdered": "true/false",
"keys": "[]",
"timeColumnName": "",
"analysisColumnNames": "[]",
"interval": "-1"
}
isOrdered specifies whether the input data is ordered. If the input sequence is sorted in ascending order by time, set it to true. Otherwise, set it to false.
interval specifies the interval of the time series in seconds. For example, if the sequence has one data point per minute, set it to 60. If the interval is uncertain, set it to -1.
timeColumnName specifies the name of the time dimension in the input sequence.
analysisColumnNames specifies the names of the numerical feature dimensions to be analyzed in the input sequence. The names are represented by an array, and the array must be serialized into a string.
keys specifies the names of all columns in the input data. The names are represented by an array, and the array must be serialized into a string.
Parameters related to body.input
[
{
"{column_name}": "{column_value}"
}
]
The input content is an array, where:
column_name indicates the name of a field in the sequence.
column_value indicates the value of a field in the sequence. When {column_name} is equal to {timeColumnName}, the corresponding value represents the time, which is expressed as a UNIX timestamp in seconds.
High-latency trace data detection (sls_builtin_service_trace_rca)
Parameters related to body.parameter
{
"project": "",
"logstore": "",
"endpoint": "",
"role_arn": ""
}
project specifies the name of the Simple Log Service project where the trace data to be analyzed is stored.
logstore specifies the name of the Simple Log Service Logstore where the trace data to be analyzed is stored.
endpoint specifies the endpoint of the region where the project resides. You must use a public endpoint. Internal endpoints are not accessible.
role_arn specifies the ARN of the role that is authorized to access the resource. You must use the ARN of ETLRole or AuditRole.
Parameters related to body.input
[
{
"service": "",
"name": "",
"from_ts_sec": "",
"to_ts_sec": "",
"slo_ts_micro": "",
"batch_id": "",
"trace_ids": "[]"
}
]
The input content is an array, and the length of the array must be 1. The parameters are described as follows:
service specifies the service name of the trace ID or the batch of trace IDs to be diagnosed. You can obtain this value from the Logstore.
name specifies the name of the trace ID or the batch of trace IDs to be diagnosed. You can obtain this value from the Logstore.
from_ts_sec specifies the start UNIX timestamp of the time range to be analyzed, in seconds.
to_ts_sec specifies the end UNIX timestamp of the time range to be analyzed, in seconds.
batch_id specifies the name of the current batch of trace IDs to be analyzed.
trace_ids specifies the list of trace IDs corresponding to the current request. Serialize the list into a string using JSON.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response struct. Valid values:
|
||
| data |
array<object> |
The returned data. |
|
|
object |
The dataset struct. |
||
|
string |
The returned result. |
{'marker': ''} |
|
| status |
object |
The status of the task. Valid values:
|
|
|
string |
The default value is empty, which indicates that tasks in all statuses are returned. Supported statuses include success, fail, and running. Valid values:
|
200 |
The response parameters vary based on the scenario. Details are as follows:
Log content named entity recognition (sls_builtin_service_log_struct)
Content related to data
[
{
"{column_name}": "{column_value}"
}
]
Each JSON object in the output corresponds to an input JSON log, where:
column_name indicates the name of an analyzed field in the JSON log. A maximum of max_fields fields are analyzed.
column_value indicates the value of an analyzed field in the JSON log. The NER results in the field value are wrapped in the <ml_ner_${ner_type}></ml_ner_${ner_type}> tags, where ${ner_type} is the specific NER type.
Time series outlier detection (sls_builtin_service_metric_anomaly)
Content related to data
[
{
"start": "",
"end": "",
"label": ""
}
]
start indicates the start time of the detected anomaly interval.
end indicates the end time of the detected anomaly interval.
- label indicates the anomaly type of the detected interval. Valid values:
SPIKE_UP_TYPE
SPIKE_DOWN_TYPE
TREND_UP_TYPE
TREND_DOWN_TYPE
MEANSHIFT_UPWARD_TYPE
MEANSHIFT_DOWNWARD_TYPE
High-latency trace data detection (sls_builtin_service_trace_rca)
Content related to data
[
{
"traceID": "",
"service": "",
"name": "",
"rootCauses": "[{}]"
}
]
traceID indicates the trace ID to be detected.
service indicates the service name of the root node of the current trace.
name indicates the name of the root node of the current trace.
rootCauses indicates the list of spans that cause high latency in the current high-latency trace request. The list is represented by a serialized string. The deserialized structure of this field is as follows:
[
{
"spanID": "",
"service": "",
"name": "",
"host": "xxxx",
"predicateDuration": 10
}
]
Examples
Success response
JSON format
{
"data": [
{
"key": "{'marker': ''}"
}
],
"status": {
"key": "200"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.