Obtain logrecord PullLogRecord
Updated at:2025-11-03
Description
View log records in a specified logstream, and retrieve recent log contents or filter by a specific time range.
Request
- Request syntax
Text
1GET /v1/logstore/{logStoreName}/logrecord?project={project} HTTP/1.1
2Host: <Endpoint>
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 |
| logStoreName | String | Yes | Path | Logstore name |
| logStreamName | String | Yes | Query | Logstream name |
| startDateTime | DateTime | Yes | Query | Start datetime, including start time |
| endDateTime | DateTime | Yes | Query | End datetime, excluding end time |
| limit | Int | No | Query | Specify the maximum number of items to return; default: 100; maximum: 1000 |
| marker | String | No | Query | Specify the position token to view |
Notes:
- Both startDateTime and endDateTime here refer to the timestamp of logrecord
- All datetimes are in UTC ISO8601 format, for example: 2020-01-10T13:23:34Z
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Parameter name | Types | Description |
|---|---|---|
| result | List<LogRecord> | A set of logrecords |
| marker | String | Returned position token |
| isTruncated | Boolean | true: indicate more data is available; false: indicate this is the last page |
| nextMarker | String | The starting position for subsequent query, included in the request as a marker in the request to view the next page. |
The element structure of each logrecord in the result array in the above table is as follows:
| Field name | Types | Description |
|---|---|---|
| message | String | Logrecord content; if the users uploads a TEXT log, it is the raw text content; otherwise, it is the json string composed of k-v pairs in the log |
| timestamp | Int | Logrecord timestamp, accurate to millisecond |
Error code
Apart from standard error codes, the following codes may be returned:
| Error code | Error message | Description | HTTP status code |
|---|---|---|---|
| InvalidParameter | Request param invalid: [param] | param invalid | 400 |
| LogStoreStopped | LogStore stopped | LogStore write operations blocked due to debt | 403 |
| LogStoreNotFound | LogStore not found | LogStore not found | 404 |
Example
- Request example
Text
1GET /v1/logstore/demo/logrecord?project=default&logStreamName=my-stream&marker=JpJYBIUoFqHA4wxXzeRGREbUVg&limit=500&startDateTime=2019-09-01T22:00:00Z&endDateTime=2019-09-10T22:00:00Z 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
- Response example
Text
1HTTP/1.1 200 OK
2Content-Type: application/json; charset=utf-8
3
4{
5 "marker": "JpJYBIUoFqHA4wxXzeRGREbUVg",
6 "isTruncated": true,
7 "nextMarker": "dGhpcyBpcyBhbiBleGFtcGxl"
8 "result": [
9 {
10 "message": "this is a raw message",
11 "timestamp": 1542156107000
12 }
13 ]
14}
