0032-00000002

Updated at:

Problem description

The PutBucketLogging request fails because the TargetBucket element is missing from the request body.

Causes

The LoggingEnabled element requires a TargetBucket child element specifying the bucket where OSS stores access logs. When TargetBucket is omitted, OSS rejects the request.

Examples

The following request is missing TargetBucket and triggers the error:

PUT /?logging HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Content-Length: ContentLength
Content-Type: application/xml
Authorization: SignatureValue

<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus>
    <LoggingEnabled>
        <TargetPrefix>my-log-prefix/</TargetPrefix>
    </LoggingEnabled>
</BucketLoggingStatus>

Solutions

Add TargetBucket inside LoggingEnabled, before TargetPrefix:

PUT /?logging HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Content-Length: ContentLength
Content-Type: application/xml
Authorization: SignatureValue

<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus>
    <LoggingEnabled>
        <TargetBucket>my-log-bucket</TargetBucket>
        <TargetPrefix>my-log-prefix/</TargetPrefix>
    </LoggingEnabled>
</BucketLoggingStatus>

Replace my-log-bucket with the name of the bucket where you want OSS to store access logs, and my-log-prefix/ with your desired log object key prefix.

References