Queries alert logs.
Operation description
You can call the operation to query only the alert logs within the last year.
This topic provides an example to show how to query the alert logs of Elastic Compute Service (ECS) based on the product
dimension.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
cms:DescribeAlertLogList | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
StartTime | long | No | The start timestamp of the alert logs to be queried. Unit: milliseconds. You can query only the alert logs within the last year. If the query time is longer than one year, the return value of the Note
The time period between the start time specified by StartTime and the end time specified by EndTime must be less than or equal to 15 days. You must specify StartTime and EndTime at the same time, or leave StartTime and EndTime empty at the same time. If you do not specify this parameter, the alert logs within the last 15 minutes are queried by default.
| 1609988009694 |
EndTime | long | No | The end timestamp of the alert logs to be queried. Unit: milliseconds. You can query only the alert logs within the last year. If the query time is longer than one year, the return value of the Note
The time period between the start time specified by StartTime and end time specified by EndTime must be less than or equal to 15 days. You must specify StartTime and EndTime at the same time, or leave StartTime and EndTime empty at the same time. If you do not specify this parameter, the alert logs within the last 15 minutes are queried by default.
| 1610074409694 |
PageNumber | integer | No | The page number. Default value: 1. | 1 |
PageSize | integer | No | The number of entries per page. Default value: 10. | 10 |
SearchKey | string | No | The search keyword that is used to query alert logs. | alert |
GroupId | string | No | The ID of the application group. | 7301**** |
Namespace | string | No | The namespace of the cloud service. Note
For information about how to query the namespace of a cloud service, see Appendix 1: Metrics.
| acs_ecs_dashboard |
Product | string | No | The abbreviation of the service name. For information about how to obtain the abbreviation of a cloud service name, see DescribeProductsOfActiveMetricRule . | ECS |
Level | string | No | The severity level and notification methods of the alert. Valid values:
| P4 |
SendStatus | string | No | The status of the alert. Valid values:
If the value of the SendStatus parameter is 0, the value P4 of the Level parameter indicates a triggered alert and the value OK indicates a cleared alert. | 0 |
ContactGroup | string | No | The alert contact group. | ECS_Group |
RuleName | string | No | The name of the alert rule. | test123 |
MetricName | string | No | The metric name. Note
For more information about the metrics of different cloud services, see Appendix 1: Metrics.
| IntranetInRate |
LastMin | string | No | The statistical period of alert logs. Unit: minutes. | 360 |
GroupBy | string | No | The dimensions based on which data is aggregated. This parameter is equivalent to the GROUP BY clause in SQL. Valid values:
| product |
RuleId | string | No | The ID of the alert rule. For information about how to obtain the ID of an alert rule, see DescribeMetricRuleList . | bc369e8_30f87e517ed2fc**** |
SourceType | string | No | The type of the alert rule. Valid value: METRIC. This value indicates an alert rule for time series metrics. | METRIC |
EventType | string | No | The type of the alert event. Valid values:
| TRIGGERED |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "1C4A3709-BF52-42EE-87B5-7435F0929585",
"Success": true,
"Code": "200",
"Message": "The specified resource is not found.",
"PageNumber": 1,
"PageSize": 10,
"AlertLogList": [
{
"MetricName": "cpu_total",
"EventName": "IOHang",
"Product": "ECS",
"BlackListUUID": "8410dbbd-7d30-41c5-94cb-*****",
"Message": "{\"alertName\":\"e47aa0ac-4076-44db-a47d-d1083968****_Availability\"}",
"Namespace": "acs_ecs_dashboard",
"LevelChange": "P4->OK",
"InstanceId": "i-m5e1qg6uo38rztr4****",
"RuleName": "",
"RuleId": "d582b9e9-b1c1-4f17-9279-0fe7333a****_ResponseTime",
"BlackListName": "{\"id\":123,\"metricProject\":\"acs_ecs_dashboard\",\"userId\":1736511134389110,\"uuid\":\"8410dbbd-7d30-41c5-94cb-***\",\"name\":\"alert-***\",\"productCategory\":\"ecs\",\"instances\":[{\"instanceId\":\"host-***\"}],\"metrics\":null,\"scopeType\":\"USER\",\"scopeValue\":\"\",\"startTime\":\"0001-01-01T00:00:00Z\",\"endTime\":\"9999-12-31T23:59:59.999999999+08:00\",\"effectiveTime\":null,\"isEnable\":true,\"status\":1,\"gmtCreate\":\"2021-11-02T16:35:59+08:00\",\"gmtModified\":\"2021-11-02T16:35:59+08:00\",\"loadTime\":\"2021-11-02T16:36:15.213072177+08:00\"}",
"GroupName": "ECS_Instances",
"GroupId": "7301****",
"AlertTime": "1610043776621",
"InstanceName": "portalHost",
"BlackListDetail": "BlackListDetail",
"Level": "P4",
"SendStatus": "0",
"ExtendedInfo": [
{
"Name": "userId",
"Value": "120886317861****"
}
],
"Dimensions": [
{
"Key": "instanceId",
"Value": "i-m5e1qg6uo38rztr4****"
}
],
"WebhookList": [
{
"code": "200",
"url": "https://www.aliyun.com/webhook.html",
"message": "success"
}
],
"DingdingWebhookList": [
"https://oapi.dingtalk.com/robot/send?access_token=b7ff24032da1a5f86659ecda46797e13cc1d4e4da6903d7b014ea1d1488b****"
],
"ContactOnCallList": [
"1368888****"
],
"ContactMailList": [
"username@example.com"
],
"ContactGroups": [
"ECS_Group"
],
"ContactALIIWWList": [
"Alice"
],
"ContactSMSList": [
"1368888****"
],
"ContactDingList": [
"CloudMonitor"
],
"SendDetail": {
"ResultCode": "success",
"ChannelResultList": [
{
"Channel": "MAIL",
"ResultList": [
{
"Code": "200",
"RequestId": "0BDAF8A8-04DC-5F0C-90E4-724D42C4****",
"Success": true,
"Detail": "{ }",
"notifyTargetList": [
"1270676********"
]
}
]
}
]
},
"Escalation": {
"Expression": "$Average<90",
"Times": 1,
"Level": "P4"
},
"SendResultList": [
{
"Key": "Mail",
"Value": [
"username@example.com"
]
}
],
"LogId": "7818361[1523]@1671593992[1]"
}
]
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | ParameterInvalid | %s | - |
403 | AccessForbidden | User not authorized to operate on the specified resource. | - |
404 | ResourceNotFound | The specified resource is not found. | The specified resource is not found. |
409 | ResourceConflict | Concurrent modification of resources. | - |
409 | ResourceExist | Resources already exist. | - |
500 | InternalError | The request processing has failed due to some unknown error. | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-12-07 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-07-27 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2022-09-29 | The Error code has changed. The response structure of the API has changed | View Change Details |