GET Bucket logging

Last updated: 2021-08-30 14:39:12

    Overview

    This API is used to query the logging configuration of a source bucket.

    Note:

    Only the owner of the source bucket has permission to call this API.

    Request

    Sample request

    GET /?logging HTTP 1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT Date
    Authorization: Auth String
    
    Note:

    Request headers

    This API only uses Common Request Headers.

    Request body

    The request body of this request is empty.

    Response

    Response headers

    This API only uses Common Response Headers.

    Response body

    The response body returns application/xml data. The following contains all the nodes:

    <BucketLoggingStatus>
    <LoggingEnabled>
      <TargetBucket>examplebucket-1250000000</TargetBucket>
      <TargetPrefix>prefix</TargetPrefix>
    </LoggingEnabled>
    </BucketLoggingStatus>
    

    The nodes are as follows:

    Node Name (Keyword) Parent Node Description Type
    BucketLoggingStatus None Logging status of the bucket Container

    Content of BucketLoggingStatus:

    Node Name (Keyword) Parent Node Description Type
    LoggingEnabled BucketLoggingStatus Detailed configuration of bucket logging Container

    Content of LoggingEnabled:

    Node Name (Keyword) Parent Node Description Type
    TargetBucket LoggingEnabled Destination bucket that stores logs. It can be a bucket under the same account or in the same region as the source bucket, or the source bucket itself (not recommended). String
    TargetPrefix LoggingEnabled Path in the destination bucket that stores logs String

    Error codes

    This API returns common error responses and error codes. For more information, please see Error Codes.

    Sample

    Request

    GET /?logging HTTP 1.1
    Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
    Date: Wed, 28 Oct 2017 21:32:00 GMT
    Authorization: q-sign-algorithm=sha1&q-ak=AKIDWtTCBYjM5O****&q-sign-time=1484815944;32557711944&q-key-time=1484815944;32557711944&q-header-list=host&q-url-param-list=accelerate&q-signature=a2d28e1b9023d09f9277982775a4b3b705d0****
    

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 142
    Connection: keep-alive
    Date: Wed, 28 Oct 2017 21:32:00 GMT
    Server: tencent-cos
    x-cos-request-id: NTg4MDdlNGZfNDYyMDRlXzM0YWFf****
    <BucketLoggingStatus>
    <LoggingEnabled>
      <TargetBucket>examplebucket-1250000000</TargetBucket>
      <TargetPrefix>prefix</TargetPrefix>
    </LoggingEnabled>
    </BucketLoggingStatus>