PUT Bucket Logging

You can perform this operation to control access to logs. You can perform this operation to grant specific users permission to view or modify bucket log parameters. This PUT operation uses the logging subresource to set the logging parameters of a bucket. In the current OBS version, only the bucket owner or users granted the s3:PutBucketLogging permission can view or modify the bucket logging parameters.

By default, logs are not created during bucket creation. The logs for a bucket are created after logging is enabled and the log delivery group has the WRITE and READ_ACP permissions for the bucket which stores logs. To enable logging, configure the log management function in the LoggingEnabled request element in an uploaded logging file. You can disable logging by uploading a logging file with an empty BucketLoggingStatus request element.

When configuring bucket log management, the owner of the source bucket can specify a target bucket to store logs. The owner of the source bucket can only deliver logs to any bucket of the owner. At the same time, the target bucket and source bucket must reside in the same region. In addition, buckets whose default storage classes are OBS Infrequent Access or OBS Archive cannot be target buckets.

Request Syntax

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

logging configuration

Request Parameters

This request contains no parameter.

Request Headers

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

Request Elements

Table 1 Request 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 you are enabling logging (and absent when you are disabling logging). You can add specific logging information in this element.

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. This optional element enables you to grant access to others.

Type: string

Valid values: FULL_CONTROL | READ | WRITE

Optional

TargetBucket

Indicates the target bucket where bucket logs are stored. You can only have your logs delivered to any bucket that you own. User groups that deliver logs to the target bucket must have the WRITE and READ_ACP permissions. 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

Required

TargetPrefix

Indicates a prefix for keys of logs to be stored.

Type: string

Required

TargetGrants

Indicates the container for granting information.

Type: container

Optional

Response Syntax

HTTP/1.1 status_code
Date: date
Content-Length: length

Response Headers

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

Response Elements

This response contains no element.

Error Responses

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

Registration