Queries the logs in a specified location based on the cursor.

Description

Request syntax

GET /logstores/ay42/shards/0? type=logs&cursor=MTQ0NzMyOTQwMTEwMjEzMDkwNA==&count=100 HTTP/1.1
Accept: application/x-protobuf
Accept-Encoding: lz4
Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1

Request parameters

  • Request headers
    • Accept: application/x-protobuf
    • Accept-Encoding: LZ4, deflate, or “”.

    For information about the common request headers of Log Service API operations, see Common request headers.

  • Parameters
    Parameter Type Required Example Description
    type string Yes logs This parameter must be set to logs.
    cursor string Yes MTQ0NzMyOTQwMTEwMjEzMDkwNA The cursor. It indicates the position from which data is read.
    count int Yes 1000 The number of log groups to return. Valid values: 1 to 1000.

Response parameters

  • Response headers
    • x-log-cursor: the cursor of the next log.
    • x-log-count: the number of returned logs.
    For information about the common response headers of Log Service API operations, see Common response headers.
  • Response elements

    Serialized data in the protobuf format is returned. The data may be compressed.

Examples

  • Sample requests
    Read data from shard 0.
    GET /logstores/sls-test-logstore/shards/0? cursor=MTQ0NzMyOTQwMTEwMjEzMDkwNA==&count=1000&type=log  
    Header:
    {
        "Authorization"="LOG <yourAccessKeyId>:<yourSignature>", 
        "x-log-bodyrawsize"=0, 
        "User-Agent" : "sls-java-sdk-v-0.6.0", 
        "x-log-apiversion" : "0.6.0", 
        "Host" : "ali-test-project.cn-hangzhou-failover-intranet.sls.aliyuncs.com", 
        "x-log-signaturemethod" : "hmac-sha1", 
        "Accept-Encoding" : "lz4", 
        "Content-Length": 0,
        "Date" : "Thu, 12 Nov 2015 12:03:17 GMT",
        "Content-Type" : "application/x-protobuf", 
        "accept" : "application/x-protobuf"
    }
  • Sample success responses
    Header:
    {
        "x-log-count" : "1000", 
        "x-log-requestid" : "56447FB20351626D7C000874", 
        "Server" : "nginx/1.6.1", 
        "x-log-bodyrawsize" : "34121", 
        "Connection" : "close", 
        "Content-Length" : "4231", 
        "x-log-cursor" : "MTQ0NzMyOTQwMTEwMjEzMDkwNA==", 
        "Date" : "Thu, 12 Nov 2015 12:01:54 GMT", 
        "x-log-compresstype" : "lz4", 
        "Content-Type" : "application/x-protobuf"
    }
    Body:
    The <log group list in the protobuf format> after compression.
  • Page flip

    To flip the page and get the next token without returning data, you can send an HTTP HEAD request.

Error codes

HTTP status code Error code Error message Description
404 LogStoreNotExist Logstore {Name} does not exist. The error message returned because the specified Logstore does not exist.
400 ParameterInvalid Parameter Cursor is not valid. The error message returned because the value of the cursor parameter is invalid.
400 ParameterInvalid ParameterCount should be in [0-1000]. The error message returned because the value of the count parameter is invalid. Valid values: 0 to 1000.
400 ShardNotExist Shard {ShardID} does not exist. The error message returned because the specified shard does not exist.
400 InvalidCursor this cursor is invalid. The error message returned because the cursor is invalid.
500 InternalServerError Specified Server Error Message. The error message returned because an internal server error has occurred.

For more information about the error codes, see Common error codes.