GET Bucket Logging

You can perform this operation to query the logging status of a bucket. This GET operation uses the logging subresource to return the logging status of a bucket.

Only the bucket owner or users granted the s3:GetBucketLogging permission can query the bucket logging status.

Request Syntax

GET /?logging HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Date: date
Authorization: authorization

Request Parameters

This request contains no parameter.

Request Headers

This request uses common headers. For details, see Common Request Headers.

Request Elements

This request contains no element.

Response Syntax

HTTP/1.1 status_code
Content-Type: application/xml
Date: date
Content-Length: length

<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus xmlns="http://obs.cn-north-1.myhwclouds.com/doc/2015-06-30/">
<LoggingEnabled>
    <TargetBucket>bucketName</TargetBucket>
    <TargetPrefix>prefix</TargetPrefix>
        <TargetGrants>
            <Grant>
                <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
                    <ID>id</ID>
                    <DisplayName>displayName</DisplayName>
                </Grantee>
                <Permission>permission</Permission>
            </Grant>
        </TargetGrants>
    </LoggingEnabled>
</BucketLoggingStatus>

Response Headers

This response uses common headers. For details, see Common Response Headers.

Response Elements

This response contains elements to specify the bucket logging status. Table 1 describes the elements.

Table 1 Response elements

Element

Description

Required or Optional

BucketLoggingStatus

Indicates the container for logging status information.

Type: container

Required

LoggingEnabled

Indicates the container for logging information. This element is present when logging is enabled. Otherwise, this element is absent.

Type: container

Optional

Grant

Indicates the container for the grantee and the grantee's logging permission.

Type: container

Optional

Grantee

Indicates the container for users granted the logging permission.

Type: container

Optional

ID

Indicates the grantee domain ID, a globally unique ID.

Type: string

Optional

DisplayName

Indicates the grantee name. This element is not globally unique but a user ID corresponds to only one name.

Type: string

Optional

Permission

Indicates the logging permission granted to the grantee for a bucket. The bucket owner is automatically granted the FULL_CONTROL permission when creating the bucket. Logging permissions control access to different logs.

Type: string

Valid values: FULL_CONTROL | READ | WRITE

Optional

TargetBucket

Indicates the target bucket where bucket logs are stored. In OBS, logs of multiple buckets can be stored in the same target bucket. In this case, you need to use a different TargetPrefix for each source bucket to distinguish the logs.

Type: string

Optional

TargetPrefix

Indicates a prefix for keys of logs to be stored.

Type: string

Optional

TargetGrants

Indicates the container for granting information.

Type: container

Optional

Error Responses

No special error responses are returned. For details about error responses, see Table 1.

Registration