PUT Bucket logging

最近更新时间:2020-04-03 02:42:39

PUT Bucket logging


Description

This PUT operation uses the 'logging' resource to set the log parameters of user space and specify the users who are allowed to view and change the log parameters.

The user using this interface needs to be the owner of this space.

The space owner is granted 'FULL_CONTROL 'permission for all logs by default. Users can authorize other users through the 'Grantee' request parameter. The request parameter 'Permissions' can set the specific content of permissions. (this type of authorization is not supported temporarily) To enable logging, users need to set 'loggingEnabled' and its child tags.

To close the log, the user needs to set the 'BucketLoggingStatus' request parameter to null.

<BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" />

Request

Grammar

PUT /?logging HTTP/1.1
Host: {BucketName}.{endpoint}
Date: {date}
Authorization: {SignatureValue}

Request elements vary depending on what you're setting.

Note:

Request parameters

The interface does not use request parameters.

Request header

This interface only uses common request headers. For more information, please click Public request headers.

Request content

Name Descripton
BucketLoggingStatus Container for response information.
Type: Container
Parent node: None
EmailAddress E-mail of the user who has permission to view log information.
Type: String
Parent node: BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant.Grantee
Grant Container for information about the authorized person and their permissions. (not supported temporarily)
Type: Container
Parent node: BucketLoggingStatus.LoggingEnabled.TargetGrants
Grantee Container for information about users with view rights. (not supported temporarily)
Type: Container
Parent node: BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant
LoggingEnabled Container for log information. When logging is enabled, the container and its child nodes appear, otherwise, they disappear.
Type: Container
Parent node: BucketLoggingStatus
Permission The permission of the authorized person to the log of user space. (not supported temporarily)
Parent node: BucketLoggingStatus.LoggingEnabled.TargetGrants.Grant
TargetBucket Specify the user space to return log information.
Type: String
Parent node: BucketLoggingStatus.LoggingEnabled
TargetGrants Container for authorization information. (not supported temporarily)
Type: Container
Parent node: BucketLoggingStatus.LoggingEnabled
TargetPrefix Specifies the prefix of the key value (logical hierarchy + filename) where the log file is stored.
Type: String
Parent node: BucketLoggingStatus.LoggingEnabled

Ways to grant permissions

Users can grant a user permission to log in the following ways. Through user ID

<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>{ID}</ID><DisplayName>{GranteesEmail}</DisplayName>
</Grantee>

Through URI

<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group"><URI>http://acs.ksyun.com/groups/global/AllUsers</URI></Grantee>

Note: currently only http://acs.ksyun.com/groups/global/allusers is supported, indicating all users, including anonymous users.

Response

Response header

This interface can use all common response headers. For more information, please click Public response headers

Response content

The interface does not return the corresponding content.

Special errors

The interface does not return any special errors.

Example

Request example

PUT /?logging HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyun.com
Content-Length: 214
Date: Fri, 26 Dec 2014 06:38:43 GMT
Authorization: authorization string

<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01">
  <LoggingEnabled>
    <TargetBucket>ks3-example</TargetBucket>
    <TargetPrefix>mybucket-access_log-/</TargetPrefix>
    <TargetGrants>
    </TargetGrants>
  </LoggingEnabled>
</BucketLoggingStatus>

Response example

HTTP/1.1 200 OK
Date: Fri, 26 Dec 2014 06:38:43 GMT
Server: Tengine

Example of a request to close a log

PUT /?logging HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyun.com
Content-Length: 214
Date: Fri, 26 Dec 2014 06:38:43 GMT
Authorization: authorization string

<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" />

Example of a response to close a log

HTTP/1.1 200 OK
Date: Fri, 26 Dec 2014 06:38:43 GMT
Server: Tengine

Interface details

  • This interface can enable the bucket log function. KS3 will upload the daily request log of the bucket to the bucket specified by the user.
  • The source bucket and the target bucket must be two or one bucket belonging to the same user and the same region. It is recommended to use two different bucket, and the target bucket is specially used to store logs.
  • Only the bucket owner has permission to use the interface.

金山云,开启您的云计算之旅

注册有礼