putBucketLogging method
Written by
Updated at September 30, 2024
Enables and disables bucket actions logging.
For more information on getting started with the API and the general request format, see How to use the S3 API.
Request
PUT /{bucket}?logging HTTP/2
Path parameters
Parameter | Description |
---|---|
bucket |
Bucket name. |
Query parameters
Parameter | Description |
---|---|
logging |
Required parameter that indicates the type of operation. |
Data schema
To enable bucket actions logging:
<?xml version="1.0" encoding="UTF-8" ?>
<BucketLoggingStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LoggingEnabled>
<TargetBucket>bucket-logs</TargetBucket>
<TargetPrefix>logs/</TargetPrefix>
</LoggingEnabled>
</BucketLoggingStatus>
Element | Description |
---|---|
BucketLoggingStatus |
Root element. |
TargetBucket |
Name of the target bucket where the log objects are saved. Type: String. |
TargetPrefix |
Log object key prefix. Type: String. |
To disable bucket actions logging:
<BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" />
Headers
Use only common headers in your requests.
Response
Headers
Responses can only contain common headers.
Response codes
For a list of possible responses, see Responses.
A successful response does not contain any additional data.