PreviewAlarmLogRecord
Updated at:2025-11-03
Description
- Preview alert task LogRecords, at most 1000 logs returned
- The query statement does not support pure search statements
match ..., but can support query statementsselect ...and query statements with search conditionsmatch ...| select ...
Request
- Request syntax
Http
1GET /v1/alarm/{logStoreName}/logrecord?project={project}&query={query}&startDateTime={startDateTime}&endDateTime={endDateTime} HTTP/1.1
2Host: bls-log.bj.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 |
|---|---|---|---|---|
| project | String | no | Query | Project name, default |
| logStoreName | String | yes | Path | Logstore name |
| query | String | yes | Query | Query |
| startDateTime | DateTime | yes | Query | Start datetime, including start time, in UTC format |
| endDateTime | DateTime | yes | Query | End datetime, excluding end time, in UTC format |
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Parameter name | Types | Required or not | Description | Value format |
|---|---|---|---|---|
| columns | LIST[String] | no | column name of dataset | Return empty when no results are found |
| rows | LIST[LIST[Obj]] | no | Each row corresponds to the column name in columns | obj is the value corresponding to each column; return empty when no results are found |
| isTruncated | Bool | yes | Whether the result set is truncated | true/false |
| truncatedReason | String | no | Reason for result set truncation; omitted if not truncated | - |
| metricExtractErr | String | no | Execute err in push metrics according to query information | Exclude this field in case of no error |
| metricNameList | LIST[String] | yes | Extracted field information that may become a push metrics | - |
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 |
Note: [logStoreName] in error message may be replaced with a specific name.
Example
- Request example
Http
1POST /v1/alarm/store/logrecord?project=default&startDateTime=2019-09-01T22:00:00Z&endDateTime=2019-09-01T23:00:00Z&query=select t, cast(t as timestamp), count(1) 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
- Response example
Http
1HTTP/1.1 201
2Content-Type: application/json; charset=utf-8
3{
4 "columns": [
5 "t",
6 "cast(t as timestamp)",
7 "count(1)"
8 ],
9 "rows": [
10 [
11 1573603200000,
12 "2019-11-13T00:00:00Z",
13 6151
14 ],
15 [
16 1573603260000,
17 "2019-11-13T00:01:00Z",
18 4880
19 ]
20 ],
21 "isTruncated": true,
22 "truncatedReason": "PiecesQuotaExceed",
23 "metricNameList": ["t", "cast(t as timestamp)", "count(1)"]
24}
