Queries 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAlertLogList

The operation that you want to perform. Set the value to DescribeAlertLogList.

StartTime Long No 1609988009694

The start timestamp of the alert logs to be queried.

Unit: milliseconds.

Note
  • 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 AlertLogList parameter is empty.
  • The interval between the start time (StartTime) and end time (EndTime) must be less than or equal to 15 days.
EndTime Long No 1610074409694

The end timestamp of the alert logs to be queried. Unit: milliseconds.

Note
  • 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 AlertLogList parameter is empty.
  • The interval between the start time (StartTime) and end time (EndTime) must be less than or equal to 15 days.
PageNumber Integer No 1

The number of the page to return.

Default value: 1.

PageSize Integer No 10

The number of entries to return on each page.

Default value: 10.

SearchKey String No alert

The search keyword that is used to query alert logs.

GroupId String No 7301****

The ID of the application group.

Namespace String No acs_ecs_dashboard

The namespace of the cloud service.

Note For more information about the namespaces of cloud services, see Appendix 1: Metrics.
Product String No ECS

The abbreviation of the service name.

For more information about how to obtain the abbreviation of a cloud service name, see DescribeProductsOfActiveMetricRule.

Level String No P4

The severity level and notification methods of the alert. Valid values:

  • P4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
SendStatus String No 0

The alert status. Valid values:

  • 0: The alert is triggered or cleared.
  • 1: The alert is ineffective.
  • 2: The alert is muted and not triggered in a specified period.
  • 3: The host is restarting.
  • 4: No alert notification is sent.

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.

ContactGroup String No ECS_Group

The alert contact group.

RuleName String No test123

The name of the alert rule.

MetricName String No IntranetInRate

The name of the metric.

Note For more information about the metrics of different cloud services, see Appendix 1: Metrics.
LastMin String No 360

The statistical period of alert logs. Unit: minutes.

GroupBy String No product

The dimension based on which data is aggregated. This parameter is equivalent to the GROUP BY clause in SQL. Valid values:

  • product: aggregates data by cloud service.
  • level: aggregates data by alert level.
  • groupId: aggregates data by application group.
  • contactGroup: aggregates data by alert contact group.
  • product,metricName: aggregates data both by cloud service and by metric.
RuleId String No bc369e8_30f87e517ed2fc****

The ID of the alert rule.

For information about how to query the ID of an alert rule, see DescribeMetricRuleList.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 1C4A3709-BF52-42EE-87B5-7435F0929585

The request ID.

Success Boolean true

Indicates whether the request was successful. Valid values:

  • true
  • false
Code String 200

The HTTP status code.

Note The status code 200 indicates that the request was successful.
Message String The specified resource is not found.

The error message.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

AlertLogList Array of Alarm

The alert logs.

MetricName String cpu_total

The name of the metric.

EventName String IOHang

The name of the event.

Product String ECS

The identifier of the cloud service. Valid values:

  • If the cloud service is provided by Alibaba Cloud, the abbreviation of the service name is returned. Example: ECS.
  • If the cloud service is not provided by Alibaba Cloud, a value in the acs_Service keyword format is returned. Example: acs_networkmonitor.
BlackListUUID String 8410dbbd-7d30-41c5-94cb-****

The universally unique identifier (UUID) of the blacklist policy.

Message String {"alertName":"e47aa0ac-4076-44db-a47d-d1083968****_Availability"}

The alert information in a JSON string.

Namespace String acs_ecs_dashboard

The namespace of the cloud service.

LevelChange String P4->OK

Indicates whether the alert level was changed. Valid values:

  • P4->OK: The alert level was changed from P4 to OK.
  • P4->P4: The alert level was still P4.
InstanceId String i-m5e1qg6uo38rztr4****

The resource ID.

RuleName String CPU utilization

The name of the alert rule.

RuleId String d582b9e9-b1c1-4f17-9279-0fe7333a****_ResponseTime

The ID of the alert rule.

BlackListName String Black_Test

The name of the blacklist policy.

GroupName String ECS_Instances

The name of the application group.

GroupId String 7301****

The ID of the application group.

AlertTime String 1610043776621

The timestamp that was generated when the alert was triggered.

Unit: milliseconds.

InstanceName String portalHost

The resource name.

BlackListDetail String {"id":12****,"metricProject":"acs_ecs_dashboard","userId":173651113438****,"uuid":"8410dbbd-7d30-41c5-94cb-****","name":"alert-****","productCategory":"ecs","instances":[{"instanceId":"i-m5e1qg6uo38rztr4****"}],"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"}

The details of the blacklist policy.

Level String P4

The severity level and notification methods of the alert. Valid values:

  • P4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
SendStatus String 0

The alert status. Valid values:

  • 0: The alert is triggered or cleared.
  • 1: The alert is ineffective.
  • 2: The alert is muted and not triggered in a specified period.
  • 3: The host is restarting.
  • 4: No alert notification is sent.

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.

ExtendedInfo Array of ExtInfo

The extended fields.

Name String userId

The name of the extended field.

Value String 100931896542****

The value of the extended field.

Dimensions Array of Dimensions

The dimensions of the resource that triggered alerts.

Key String instanceId

The key of the dimension.

Value String i-m5e1qg6uo38rztr4****

The value of the dimension.

WebhookList Array of WebhookList

The list of callback URLs.

code String 200

The status code of the alert callback.

url String https://www.aliyun.com/webhook.html

The callback URL.

message String success

The message returned for the alert callback.

DingdingWebhookList Array of String https://oapi.dingtalk.com/robot/send?access_token=b7ff24032da1a5f86659ecda46797e13cc1d4e4da6903d7b014ea1d1488b****

The webhook URLs of alert contacts.

ContactOnCallList Array of String 1368888****

The phone numbers of alert contacts that can receive alert phone calls.

Note This parameter is valid only on the China site (aliyun.com).
ContactMailList Array of String username@example.com

The email addresses of alert contacts.

ContactGroups Array of String ECS_Group

The alert contact group.

ContactALIIWWList Array of String Alice

The TradeManager IDs of alert contacts.

Note This parameter is valid only on the China site (aliyun.com).
ContactSMSList Array of String 1368888****

The phone numbers of alert contacts that can receive alert text messages.

Note This parameter is valid only on the China site (aliyun.com).
ContactDingList Array of String CloudMonitor

The DingTalk chatbots of alert contacts.

SendDetail Object

The details about the sending results of alert notifications.

ResultCode String success

Indicates whether the alert notifications are sent.

  • If the alert notifications are sent, the value "success" is returned.
  • If the configuration is invalid, no alert notification is sent and an error code is returned.
ChannelResultList Array of ChannelResult

The list of sending results that are categorized by notification method.

Channel String MAIL

The method that is used to send alert notifications. Valid values:

  • MAIL: email
  • SMS: text message
  • WEBHOOK: alert callback
  • SLS: Log Service
  • ONCALL: phone call
  • FC: Function Compute
  • MNS: Message Service queue
ResultList Array of Result

The sending results of alert notifications.

Code String 200

The HTTP status code.

  • If the value of the Channel parameter is WEBHOOK, the status code is 200 or 500.
  • If the value of the Channel parameter is MAIL, SMS, SLS, ONCALL, FC, or MNS, this parameter is empty or not returned.
RequestId String 0BDAF8A8-04DC-5F0C-90E4-724D42C4****

The request ID returned when CloudMonitor calls another cloud service.

Success Boolean true

Indicates whether the request was successful. Valid values:

  • true
  • false
Detail String { }

The details of the returned results.

notifyTargetList Array of String MAIL

The list of notification methods.

Escalation Object

The alert rule based on which the alert is triggered.

Expression String $Average<90

The description of the alert rule.

Note This parameter is the content of the alert rule. If the metric value meets the alert condition, an alert is triggered.
Times Integer 1

The consecutive number of times for which the metric value meets the trigger condition before an alert is triggered.

Level String P4

The severity level and notification methods of the alert. Valid values:

  • P4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
SendResultList Array of SendResult

The sending results of alert notifications.

Key String MAIL

The category of the alert notification method. Valid values:

  • MAIL: email
  • ALIIM: TradeManager
  • SMS: text message
  • CALL: phone call
  • DING: DingTalk chatbot
  • Merged: alert merging
Value Array of String username@example.com

The notification object corresponding to the alert notification method.

LogId String 7510****::e8a472a0-46ae-4ac0-84b1-e46be368****

The log ID.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeAlertLogList
&Product=ECS
&GroupBy=product
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeAlertLogListResponse>
	<AlertLogList>
		<GroupName></GroupName>
		<Message>{\"alertName\":\"d582b9e9-b1c1-4f17-9279-0fe7333a****_ResponseTime\",\"curLevel\":\"OK\",\"dimensions\":{\"taskId\":\"d582b9e9-b1c1-4f17-9279-0fe7333a****\",\"userId\":\"127067667954****\"},\"escalation\":{\"expression\":\"$Average>=800\",\"level\":P4,\"tag\":\"P4\",\"times\":1}</Message>
		<RuleId>d582b9e9-b1c1-4f17-9279-0fe7****_ResponseTime</RuleId>
		<Escalation>
			<Expression>$Average>=800</Expression>
			<Times>1</Times>
			<Level>P4</Level>
		</Escalation>
		<SendStatus>0</SendStatus>
		<Product>acs_ecs_dashboard</Product>
		<MetricName>cpu_total</MetricName>
		<RuleName>CPU utilization</RuleName>
		<ContactGroups>ECS_Group</ContactGroups>
		<InstanceId></InstanceId>
		<LevelChange>P4->OK</LevelChange>
		<Dimensions>
			<Value>100931896542****</Value>
			<Key>userId</Key>
		</Dimensions>
		<Dimensions>
			<Value>i-abcdefgh12****</Value>
			<Key>instanceId</Key>
		</Dimensions>
		<EventName>AlertOk</EventName>
		<ExtendedInfo>
			<Value>i-hp34y1eiszazu49y****</Value>
			<Name>instanceId</Name>
		</ExtendedInfo>
		<ExtendedInfo>
			<Value>12706****</Value>
			<Name>userId</Name>
		</ExtendedInfo>
		<Namespace>acs_ecs_dashboard</Namespace>
		<AlertTime>1610085521564</AlertTime>
		<GroupId>7301****</GroupId>
		<InstanceName>portalHost</InstanceName>
		<Level>OK</Level>
	</AlertLogList>
	<RequestId>6FCB1AB7-57F7-4DDA-B14E-6468FAFE79D9</RequestId>
	<PageSize>10</PageSize>
	<PageNumber>1</PageNumber>
	<Code>200</Code>
	<Success>true</Success>
</DescribeAlertLogListResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "AlertLogList" : [ {
    "GroupName" : "",
    "ContactALIIWWList" : [ ],
    "Message" : "{\"alertName\":\"d582b9e9-b1c1-4f17-9279-0fe7333a****_ResponseTime\",\"curLevel\":\"OK\",\"dimensions\":{\"taskId\":\"d582b9e9-b1c1-4f17-9279-0fe7333a****\",\"userId\":\"127067667954****\"},\"escalation\":{\"expression\":\"$Average>=800\",\"level\":P4,\"tag\":\"P4\",\"times\":1}",
    "RuleId" : "d582b9e9-b1c1-4f17-9279-0f****_ResponseTime",
    "Escalation" : {
      "Expression" : "$Average>=800",
      "Times" : 1,
      "Level" : "P4"
    },
    "SendStatus" : "0",
    "Product" : "acs_ecs_dashboard",
    "MetricName" : "cpu_total",
    "ContactSMSList" : [ ],
    "RuleName" : "CPU utilization",
    "ContactGroups" : [ "ECS_Group" ],
    "DingdingWebhookList" : [ ],
    "InstanceId" : "",
    "LevelChange" : "P4->OK",
    "Dimensions" : [ {
      "Value" : "127067667954****",
      "Key" : "userId"
    }, {
      "Value" : "i-abcdefgh12****",
      "Key" : "instanceId"
    } ],
    "ContactOnCallList" : [ ],
    "ContactDingList" : [ ],
    "EventName" : "AlertOk",
    "ExtendedInfo" : [ {
      "Value" : "i-hp34y1eiszazu49y****",
      "Name" : "instanceId"
    }, {
      "Value" : "100931896542****",
      "Name" : "userId"
    } ],
    "Namespace" : "acs_ecs_dashboard",
    "AlertTime" : 1610085521564,
    "GroupId" : "7301****",
    "InstanceName" : "portalHost",
    "WebhookList" : [ ],
    "ContactMailList" : [ ],
    "Level" : "OK"
  } ],
  "RequestId" : "6FCB1AB7-57F7-4DDA-B14E-6468FAFE79D9",
  "PageSize" : 10,
  "PageNumber" : 1,
  "Code" : 200,
  "Success" : true
}

Error codes

HTTP status code Error code Error message Description
404 ResourceNotFound The specified resource is not found. The specified resource is not found.

For a list of error codes, see Service error codes.