DescribeAlarmRecord
Updated at:2025-11-03
Description
Retrieve alarm history details
Request
- Request syntax
Text
1GET /v1/alarm/record?id=${alarmId} HTTP/1.1
2Host: <Endpoint>
3Authorization: <Authorization String>
4Content-Type: application/json; charset=utf-8
- Request headers
No additional headers are required beyond the standard request headers.
- Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| alarmId | String | Yes | Path | Alarm ID |
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Field | Types | Description |
|---|---|---|
| success | Boolean | Whether the request succeeded |
| code | String | Request code, OK for success, or a specific error code for failure |
| message | String | Empty for request success, or a specific error message for request failure |
| alarm | Alarm | Alarm record details |
The element structure of Alarm object is as follows:
| Field | Types | Description |
|---|---|---|
| id | String | Alarm ID |
| groupId | String | Group ID |
| startTime | String | Alarm start time, UTC time |
| endTime | String | Alarm close time, UTC time, if the alarm is not closed, this value is an empty string |
| state | String | Alarm status, value: OK: Recovered, ALERT: Alarming, CLOSED: Disabled |
| closeReason | String | Alarm closure reason, POLICY_MODIFIED: Alarm policy update |
| policy | Policy | Alarm policy details |
| object | LogStore | Target logstore. If execution statements share a target logstore, fill in the target logstore associated with the current alarm |
| triggerCondition | TriggerCondition | Associated trigger conditions when the alarm is triggered |
| groups | Map<String, String> | Group result |
| executions | List<Execution> | Execution list |
The element structure of Policy object is as follows:
| Field | Types | Description |
|---|---|---|
| name | String | Alarm policy name, unique |
| pendingCount | Int | Continuous trigger threshold, number of consecutive times the threshold is triggered before an alarm is raised |
| repeatIntervalMinute | Int | Repeat alarm interval, unit: minutes, default value: 0, which means repeat alarm is disabled |
| recoverWithoutNotice | Bool | Whether to notify after recovery, true: no notification, false: notification, defaulting to false |
| notices | List<Notice> | Alarm notification template, reference: BCM Notification Template API |
LogStore element results are as follows:
| Field | Types | Description |
|---|---|---|
| project | String | Logstore project, defaulting to "default" |
| logStoreName | String | Logstore name |
The element structure of each target in targets array is as follows:
| Parameter name | Types | Description |
|---|---|---|
| query | String | Execution statement |
| startTimeOffsetMinute | Int | Query start time offset, value range: [-1440, 0) |
| endTimeOffsetMinute | Int | Value range: (startTimeOffsetMinute, 0] |
| object | LogStore | Fill in this field when each execution statement specifies a logstore individually |
Each TriggerCondition element structure in the triggerConditions array is as follows:
| Parameter name | Types | Description |
|---|---|---|
| level | String | Alarm level, required. Options: INFO, WARN, and CRITICAL |
| condition | String | Trigger condition expression |
Each Execution element structure in the executions array is as follows:
| Parameter name | Types | Description |
|---|---|---|
| time | String | Execution time, UTC time |
| state | String | Execution status, values: OK: Return to normal, ALERT: Alarming |
| noticeState | String | Notification status, values: NOT_SENT: Not notified, SENT: Notified, FAIL: Notification sending failed |
| reason | String | If sending failed, fill in the failure reason |
| values | Map<String, Any> | Query result data when the alarm is triggered |
| notices | List<Notice> | Alarm notification template, reference: BCM Notification Template API |
| rawLogs | List<RawLog> | Original logs in alarm notification |
Notice element structure is as follows:
| Parameter name | Types | Description |
|---|---|---|
| id | String | Alarm template ID |
| name | String | Alarm template name |
| members | List<String> | Alarm template user list |
| methods | List<String> | Alarm template notification method, values: EMAIL: Email, SMS: SMS, PHONE: Telephone |
| callbacks | List<String> | Alarm template callback address |
RawLog element structure is as follows:
| Parameter name | Types | Description |
|---|---|---|
| project | String | Logstore project |
| logStoreName | String | Logstore name |
| query | String | Query statement |
| columns | List<String> | Specified display fields |
| limit | Int | Number of displayed logs |
| logs | List<Map<String, Any>> | Displayed log content |
Error code
No special error codes are returned beyond standard error codes.
Example
- Request example
Text
1GET /v1/alarm/record?id=a-8aab556f3f7b HTTP/1.1
2Host: bls-log.bj.baidubce.com
3Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
4Content-Type: application/json; charset=utf-8
5{
6 "pageNo": 1,
7 "pageSize": 10
8}
- Response example
Text
1HTTP/1.1 201
2Content-Type: application/json; charset=utf-8
3X-Bce-Request-Id: 2eeba101-4cc7-4cfe-b5ac-a3be8d060e33
4Date: Fri, 10 Apr 2020 04:42:37 GMT
5{
6 "success": true,
7 "msg": "", // If failed, return the failure reason
8 "alarm": {
9 "id": "a-8aab556f3f7b", // Alarm ID
10 "groupId": "Y4gLRiPS", // Group ID
11 "startTime": "2024-04-10T10:12:30Z", // Alarm start time, UTC time
12 "endTime": "2024-04-10T11:21:31Z", // Alarm end time, UTC time. If the alarm is not closed, this value is an empty string
13
14 // Alarm status, options:
15 // OK - Recovered
16 // ALERT - Alerting
17 // CLOSED - Closed
18 "state": "ALERT",
19
20 // Alarm closure reason, options:
21 // POLICY_MODIFIED - Alarm policy updated
22 "closeReason": "POLICY_MODIFIED",
23
24 // Associated alarm policy
25 "policy": {
26 "name": "policy-name", // Policy name
27 "pendingCount": 1, // Continuous trigger threshold, number of consecutive times the threshold is triggered before an alarm is raised
28 "notices": [], // Notification list
29 },
30
31 // Target logstore. If execution statements share a target logstore, fill in the target logstore associated with the current alarm
32 "object": {
33 "logStoreName": "log-store-test", // Logstore name
34 },
35 // Associated trigger conditions when the alarm is triggered
36 "triggerCondition": {
37 // Alarm level, options:
38 // INFO - Notification,
39 // WARN - Warning
40 // CRITICAL - Critical
41 "level": "WARN",
42
43 // Trigger condition expression
44 "condition": "$1.pv > 100",
45 },
46 // Group result
47 "groups": [
48 {"key": "$1.prov", "value": "bj"},
49 ],
50 // Execution list
51 "executions": [
52 {
53 "time": "2024-04-10T10:12:30Z", // Execution time
54
55 // Execution status, options:
56 // ALERT - Alert
57 // OK - Restore to normal, optional
58 "state": "ALERT",
59
60 // Notification status, options:
61 // NOT_SENT - Not notified
62 // SENT - Notified
63 // FAIL - Notification sending failed
64 "noticeState": "SENT",
65 "reason": "", // If sending fails, fill in the failure reason
66
67 // Query result data when the alert is triggered
68 "values": [
69 {"key": "$1.prov", "value": "bj"},
70 {"key": "$1.pv", "value": 1000},
71 ],
72
73 "notices": [
74 {
75 "id": "dfa4298f-75e2-4e17-89f6-d41ea98ea196", // Template ID
76 "name": "Default notification", // Template name
77 // User list
78 "members": ["testUsername"],
79 // Notification methods, options:
80 // EMAIL - Email
81 // SMS - SMS
82 // PHONE - Phone
83 "methods": ["EMAIL", "SMS", "PHONE"],
84 "callbacks": ["http://callback"], // Callback URL list
85 }
86 ],
87 "rawLogs": [
88 {
89 // Logstore project
90 "project" : "default",
91 // Logstore name
92 "logStoreName" : "bls-router",
93 // Query statement
94 "query" : "match userId:bbede3f8c42e4113b6971fd09a57f494",
95 // Specified display fields
96 "columns" : ["userId", "requestid", "ip"],
97 // Maximum number of logs
98 "limit" : 3,
99 // Displayed log content
100 "logs" : [
101 {
102 "@timestamp" : 1721898797668,
103 "userId" : "bbede3f8c42e4113b6971fd09a57f494",
104 "requestid" : "a-ZC1Zxpxy",
105 "ip": "127.0.0.1",
106 }
107 ]
108 },
109 {
110 "project" : "default",
111 "logStoreName" : "bls-router",
112 "query" : "match *",
113 "columns" : [], // If not filled or empty, display all fields
114 "limit" : 2,
115 "logs" : [],
116 }
117 ]
118 }
119 ]
120 }
121}
