updateLogAlarm
Updated at:2025-11-03
Description
- Update the relevant alert task configuration, excluding logStoreName.
- Complete the configuration of alert task in the process of updating
Request
- Request syntax
Http
1PUT /v1/alarm HTTP/1.1
2Host: bls-log.{region}.baidubce.com
3Authorization: authorization string
- Request headers
No additional headers are required beyond the standard request headers.
- Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| alarmName | String | yes | body | Alert task name, at most 80 characters, including letters, digits, - and _ |
| alarmConfig | AlarmConfig | yes | body | Alert task configuration |
AlarmConfig structure:
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| alarmQuery | String | yes | body | Query statement |
| alarmTimeRange | Int | yes | body | Query time range, unit: minute, range: 1-1440 |
| frequency | Int | yes | body | Metric pushing period, unit: minute, range: 1-1440; it is recommended to be the same as the query statement time range |
| metric | Metric | yes | body | Push metric information |
Metric structure:
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| metricName | String | yes | body | Push metric name, 3-50 characters, including letters, digits, - and _ |
| dimensions | LIST[Dimension] | no | body | Dimension Information |
Dimension structure:
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| name | string | yes | body | Dimension name, consisting of 50 characters at most, including letters, digits, - and _ |
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
None
Error code
Apart from standard error codes, the following codes may be returned:
| Error code | Error message | Description | HTTP status code |
|---|---|---|---|
| LogStoreNotFound | LogStore [logStoreName] not exists | Logstore not exist | 404 |
| Invalid request parameter | [Metric] composed of English letters, digits, hyphens and underscores, length: 3-50 | Metric name inconsistent with regulations | 400 |
Note: [logStoreName] in error message may be replaced with a specific name.
Example
- Request example
Http
1PUT /v1/alarm/{alarm-1-1-11} 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 "alarmName": "alarm1",
7 "alarmConfig": {
8 "alarmQuery": "select count(error) as errCount, error group by error",
9 "alarmTimeRange": 10,
10 "frequency": 10,
11 "metric": {
12 "metricName": "errCount",
13 "dimensions": [
14 "name": "error",
15 }]
16 }
17 }
18}
- Response example
Http
1HTTP/1.1 201
2Content-Type: application/json; charset=utf-8
3200
