Description
The GET Bucket logging API is used to obtain the log configuration of the source bucket.
Note:
Only the owner of the source bucket can call this API.
Request
Request Example
GET /?logging HTTP 1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String
Note:
<BucketName-APPID>is the bucket name with APPID as the suffix, for example, examplebucket-1250000000.- Authorization: Auth String (For details, see Request Signature documentation).
Request Header
This API only uses common request headers. For details, see Common Request Headers documentation.
Request Body
The request body of this request is empty.
Response
Response Headers
This API only returns the public response header. For details, see Common Response Headers documentation.
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 data are as follows:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| BucketLoggingStatus | No | Log status of the bucket. | Container |
Content of the BucketLoggingStatus node of the Container type:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| LoggingEnabled | BucketLoggingStatus | Detailed logging configuration of the bucket. | Container |
Content of the LoggingEnabled node of the Container type:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| TargetBucket | LoggingEnabled | Destination bucket for storing logs, which can be the same bucket (not recommended), or a bucket under the same account in the same region. | String |
| TargetPrefix | LoggingEnabled | Path in the destination bucket that stores logs. | String |
Error Code
This API follows unified error response and error codes. For details, please refer to the Error Codes document.
Practical Case
Request
GET /?logging HTTP 1.1
Host: <BucketName-APPID>.<Endpoint>
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
x-cos-request-id: NTg4MDdlNGZfNDYyMDRlXzM0YWFf****
<BucketLoggingStatus>
<LoggingEnabled>
<TargetBucket>examplebucket-1250000000</TargetBucket>
<TargetPrefix>prefix</TargetPrefix>
</LoggingEnabled>
</BucketLoggingStatus>