ListAlarmRecord
Updated at:2025-11-03
Description
Retrieve Alarm History list
Request
- Request syntax
Text
1POST /v1/alarm/record/list HTTP/1.1
2Host: <Endpoint>
3Authorization: <Authorization String>
4Content-Type: application/json; charset=utf-8
5{
6 "policyNamePattern": "<policyNamePattern>"
7}
- Request headers
No additional headers are required beyond the standard request headers.
- Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| policyNamePattern | String | No | RequestBody | Filter by policy name |
| policyIdPattern | String | No | RequestBody | Filter by policy ID |
| logStoreNamePattern | String | No | RequestBody | Filter by logstore |
| level | String | No | RequestBody | Filter by alarm level, values: INFO, WARN, CRITICAL |
| state | String | No | RequestBody | Filter by alarm status, values: OK: Recovered, ALERT: Alarming, CLOSED: Disabled |
| startDateTime | String | No | RequestBody | Query start time, UTC time, default value: 30 days ago |
| endDateTime | String | No | RequestBody | Query end time, UTC time, default value: current time |
| orderBy | String | No | RequestBody | Sorting field, startTime: Alarm start time, endTime: Alarm end time, default value: startTime |
| order | String | No | RequestBody | Sorting method, asc: Ascending order, desc: Descending order, default value: desc |
| pageNo | Int | Yes | RequestBody | Page number, starting from 1 |
| pageSize | Int | Yes | RequestBody | Number of items per page, maximum: 100 |
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 |
| result | Result | Alarm record details |
The element structure of result object is as follows:
| Field | Types | Description |
|---|---|---|
| alarms | List<Alarm> | Alarm Strategy List |
| pageNo | Int | Page number |
| pageSize | Int | Number of items per page |
| totalCount | Int | Total |
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 | List<String> | Alarm closure reason, POLICY_MODIFIED: Alarm policy update |
| policy | Policy | Alarm policy details |
The element structure of Policy object is as follows:
| Field | Types | Description |
|---|---|---|
| id | String | Alarm policy ID, unique |
| name | String | Alarm policy name, unique |
| objects | List<LogStore> | List of monitor objects. Fill in this field when all logstores share the target logstore. |
| targets | List<Target> | List of execution statements |
| triggerConditions | List<TriggerCondition> | List of trigger conditions |
| groups | List<String> | Group trigger |
| schedule | Schedule | Execution cycle |
| 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 |
| state | String | Policy activation status. ENABLED: Enabled; DISABLED: Disabled |
| noticeState | String | Notification activation status, ENABLED: Enabled; DISABLED: Disabled |
| notices | List<Notice> | Alarm notification template, reference: BCM Notification Template API |
| noticeRawLogs | List<NoticeRawLog> | Whether to include original logs in alarm notifications |
Each LogStore element structure in the objects array is 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 |
Schedule element structure is as follows:
| Parameter name | Types | Description |
|---|---|---|
| intervalMinute | Int | Fixed interval, unit: minutes, value range [1, 1440] |
| fixTimeMinute | Int | Specified time, minutes of the day, value range [0, 1440) |
| dayOfWeek | Int | Fixed time frequency; 0: Daily. 1~7 represents Monday to Sunday in a week |
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 |
The element structure of NoticeRawLog is as follows:
| Parameter name | Types | Description |
|---|---|---|
| type | String | Configuration type, REF: Associated execution statement, CUSTOM: Custom search statement |
| refTarget | String | If type=REF, it represents the referenced execution statement sequence number, counting from 0 |
| customTarget | Target | If type=CUSTOM, fill in the custom execution statement |
| columns | List<String> | List of field names displayed in the original logs. If not filled, all fields will be displayed |
| limit | Int | Number of logs displayed, maximum: 5 |
Error code
No special error codes are returned beyond standard error codes.
Example
- Request example
Text
1POST /v1/alarm/record/list 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 "result": {
9 // Alarm list
10 "alarms": [
11 {
12 "id": "a-8aab556f3f7b", //Alarm ID
13 "groupId": "Y4gLRiPS", // Group ID
14 "startTime": "2024-04-10T10:12:30Z", // Alarm start time, UTC time
15 "endTime": "2024-04-10T11:21:31Z", // Alarm close time, UTC time, if the alarm is not closed, this value is an empty string
16
17 // Alarm status, options:
18 // OK - Recovered
19 // ALERT - Alerting
20 // CLOSED - Closed
21 "state": "ALERT",
22
23 // Alarm closure reason, options:
24 // POLICY_MODIFIED - Alarm policy updated
25 "closeReason": "POLICY_MODIFIED",
26
27 // Associated alarm policy
28 "policy": {
29 "name": "policy-name", // Policy name
30 // Execution statement list
31 "targets": [
32 {
33 // Execution statement
34 "query": "select sum(age) as age",
35 // Query start time offset, value range: [-1440, 0)
36 "startTimeOffsetMinute": -1440,
37 // Query end time offset, value range: (startTimeOffsetMinute, 0]
38 "endTimeOffsetMinute": 0,
39
40 // Target logstore. If each execution statement specifies a separate logstore, fill in this field
41 "object": {
42 "logStoreName": "test-logstore-52" // Logstore name
43 }
44 }
45 ],
46 },
47
48 // Associated trigger conditions
49 "triggerCondition": {
50 // Alarm level, options:
51 // INFO - Notification,
52 // WARN - Warning
53 // CRITICAL - Critical
54 "level": "WARN",
55
56 // Trigger condition expression
57 "condition": "$1.age > 1"
58 },
59
60 // Target logstore. If execution statements share a target logstore, fill in the target logstore associated with the current alarm
61 "object": {
62 "logStoreName": "log-store-test", // Logstore name
63 },
64 // Group result
65 "groups": [
66 {"key": "$1.prov", "value": "bj"},
67 ],
68
69 // Last notification time, UTC time. If no notification has been sent, change the field to an empty string
70 "lastNoticeTime": "2024-04-10T11:21:31Z",
71
72 // Notification details when the alarm is triggered
73 "notices": [
74 {
75 "id": "dfa4298f-75e2-4e17-89f6-d41ea98ea196", // Template ID
76 "name": "Default notification", // Template name
77 "members": ["testUsername"], // User list
78 // Notification methods, options:
79 // EMAIL - Email
80 // SMS - SMS
81 // PHONE - Phone
82 "methods": ["EMAIL", "SMS", "PHONE"],
83 "callbacks": ["http://callback"], // Callback URL
84 }
85 ],
86 }
87 ],
88 "pageNo": 1, // Page number
89 "pageSize": 10, // Number of items per page
90 "totalCount": 100, // Total count
91 }
92}
