Provides intelligent analysis capabilities for basic data (Log, Metric, Trace) on the Simple Log Service platform. You can invoke related models to directly obtain analysis results. Currently, the supported nodes include: Named Entity Recognition (NER) for log data, outlier detection for time series data, and root cause span identification for high-latency trace data.
Operation description
This API operation is available only at the China (Shanghai) and Singapore endpoints. 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 |
none |
*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 |
Valid values:
|
true |
| version |
string |
No |
The version of the algorithm. Different versions correspond to different algorithms. |
v1 |
| body | MLServiceAnalysisParam |
No |
The request struct. Valid values:
|
The request parameters vary depending on the scenario. Details are as follows:
Log content entity recognition (sls_builtin_service_log_struct)
Content related to body.parameter
{
"is_struct": "true",
"use_gpu": "true/false",
"max_fields": "1"
}
When is_struct is set to true, the log format is a JSON structure. Currently, only the value true is supported.
use_gpu specifies whether to use GPU resources.
max_fields specifies the maximum number of fields to analyze when the log format is a JSON structure. By default, only one field is analyzed.
Content related to body.input
[
{
"{column_name}": "{column_value}"
}
]
The input is a JSON array, where:
column_name specifies the name of a field in the JSON-structured log.
column_value specifies the value of a field in the JSON-structured log.
Time series outlier detection (sls_builtin_service_metric_anomaly)
Content related to 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 sequence 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 sequence has one data point per minute, set this parameter to 60. If the interval is unknown, set it to -1.
timeColumnName specifies the name of the time dimension in the input sequence.
analysisColumnNames specifies the names of the numeric feature dimensions to analyze in the input sequence. Use an array and serialize it into a string.
keys specifies the column names of the input data. Use an array and serialize it into a string.
Content related to body.input
[
{
"{column_name}": "{column_value}"
}
]
The input is an array, where:
column_name specifies the name of a field in the sequence.
column_value specifies the value of a field in the sequence. When {column_name} equals {timeColumnName}, the value represents the time as a UNIX timestamp, in seconds.
High-latency trace data detection (sls_builtin_service_trace_rca)
Content related to body.parameter
{
"project": "",
"logstore": "",
"endpoint": "",
"role_arn": ""
}
project specifies the name of the project in Simple Log Service where the trace data to analyze is stored.
logstore specifies the name of the Logstore in Simple Log Service where the trace data to analyze is stored.
endpoint specifies the endpoint of the region where the project resides. Use a public endpoint because internal endpoints are not accessible.
role_arn specifies the ARN of the role that has been authorized to access the resource. Use the ARN of ETLRole or AuditRole.
Content related to 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 of one or a batch of trace IDs to diagnose. You can obtain this value from the Logstore.
name specifies the operation name of one or a batch of trace IDs to diagnose. You can obtain this value from the Logstore.
from_ts_sec specifies the start UNIX timestamp of the analysis period, in seconds.
to_ts_sec specifies the end UNIX timestamp of the analysis period, in seconds.
batch_id specifies the name of the current batch of trace IDs to analyze.
trace_ids specifies the list of trace IDs in the current request. Serialize the list into a string by using JSON serialization.
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 results. |
{'marker': ''} |
|
| status |
object |
The status of the task. Valid values:
|
|
|
string |
Empty by default, which indicates that tasks in all statuses are returned. Valid values: success, fail, and running. Valid values:
|
200 |
The response elements vary depending on the scenario. Details are as follows:
Log content entity recognition (sls_builtin_service_log_struct)
Content related to data
[
{
"{column_name}": "{column_value}"
}
]
Each JSON object in the output corresponds to a JSON-structured log in the input, where:
column_name specifies the name of an analyzed field in the JSON-structured log. A maximum of max_fields fields are analyzed.
column_value specifies the value of an analyzed field in the JSON-structured log. NER results in the field value are wrapped with the tags <ml_ner_${ner_type}></ml_ner_${ner_type}>, 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 specifies the start time of the detected anomaly interval.
end specifies the end time of the detected anomaly interval.
- label specifies the anomaly type of the current 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 specifies the trace ID to detect.
service specifies the service name of the root span of the trace.
name specifies the operation name of the root span of the trace.
rootCauses specifies the list of spans that cause high latency in the trace, represented as 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.