PullLogRecord
Last Updated:2020-10-21
Description
View the log records (LogRecord) in the specified log stream, and you can get the latest log records or filter by time range.
Request
- Request syntax
GET /v1/logstore/{logStoreName}/logrecord HTTP/1.1
Host: <Endpoint>
Authorization: <Authorization String>
- Request header
Except for the public request header, there are no other special headers.
- Request parameter
Parameter name | Type | Required or not | Parameter location | Description |
---|---|---|---|---|
logStoreName | String | Yes | Path | Log set name |
logStreamName | String | Yes | Query | Log stream name |
startDateTime | DateTime | No | Query | Start date and time, including start time |
endDateTime | DateTime | No | Query | End date and time, not including end time |
limit | Int | No | Query | Specify the maximum number of entries returned, 1000 by default |
marker | String | No | Query | Specify the position marker for viewing |
Note: The date and time are all UTC time, in format ISO8601, for example: 2020-01-10T13:23:34Z.
Response
- Response header
Except for the public response header, there are no other special headers.
- Response parameter
Parameter name | Type | Description |
---|---|---|
result | List<LogRecord> | A set of log records |
marker | String | Returned position marker |
isTruncated | Boolean | true: Indicates that there is data behind, false: Indicates that it is the last page |
nextMarker | String | The starting position of the next view can be used as a marker when turning the page, and the LogRecord field description is carried in the request |
timestamp | Int | Log timestamp, accurate to the millisecond |
message | String | The log content, if the log uploaded by the user is of TEXT type, then it is the original log, otherwise it is a json string composed of k-v pairs in the log |
The structure of each LogRecord element in the result array in the above table is as follows:
Field name | Type | Description |
---|---|---|
message | String | What the log records |
timestamp | Int | Timestamp of the log record, accurate to the millisecond |
Error Code
In addition to general error codes, the following error codes may also appear.
Error code | Error message | Description | HTTP status code |
---|---|---|---|
LogStoreNotFound | LogStore [logStoreName] not exists | LogStore does not exist | 404 |
Example
- Request example
GET /v1/logstore/demo/logrecord?logStreamName=my-stream&marker=JpJYBIUoFqHA4wxXzeRGREbUVg&limit=500&startDateTime=2019-09-01T22:00:00Z&endDateTime=2019-09-10T22:00:00Z HTTP/1.1
Host: bls-log.bj.baidubce.com
Authorization: bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
- Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"marker": "JpJYBIUoFqHA4wxXzeRGREbUVg",
"isTruncated": true,
"nextMarker": "dGhpcyBpcyBhbiBleGFtcGxl"
"result": [
{
"message": "this is a raw message",
"timestamp": 1542156107000
}
]
}