put_bucket_logging¶
Operation¶
put_bucket_logging
async
¶
put_bucket_logging(request: PutBucketLoggingInput | PutBucketLoggingInputDict, /, *, plugins: list[Plugin] | None = None) -> PutBucketLoggingOutput
put_bucket_logging(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[PutBucketLoggingInputDict]) -> PutBucketLoggingOutput
Warning
End of support notice: As of October 1, 2025, Amazon S3 has discontinued
support for Email Grantee Access Control Lists (ACLs). If you attempt to
use an Email Grantee ACL in a request after October 1, 2025, the request
will receive an HTTP 405 (Method Not Allowed) error.
This change affects the following Amazon Web Services Regions: US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Europe (Ireland), and South America (São Paulo).
Note: This operation is not supported for directory buckets.
Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters. All logs are saved to buckets in the same Amazon Web Services Region as the source bucket. To set the logging status of a bucket, you must be the bucket owner.
The bucket owner is automatically granted FULL_CONTROL to all logs. You
use the Grantee request element to grant access to other people. The
Permissions request element specifies the kind of access the grantee
has to the logs.
Warning
If the target bucket for log delivery uses the bucket owner enforced
setting for S3 Object Ownership, you can't use the Grantee request
element to grant access to others. Permissions can only be granted using
policies. For more information, see Permissions for server access log
delivery
in the Amazon S3 User Guide.
- Grantee Values
-
You can specify the person (grantee) to whom you're assigning access rights (by using request elements) in the following ways. For examples of how to specify these grantee values in JSON format, see the Amazon Web Services CLI example in Enabling Amazon S3 server access logging in the Amazon S3 User Guide.
- By the person's ID:
<grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><id><>ID<>``</id><displayname><>GranteesEmail<>``</displayname>``</grantee>DisplayNameis optional and ignored in the request.- By Email address:
``<grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail"><emailaddress><>Grantees@email.com<>``</emailaddress></grantee>The grantee is resolved to the
CanonicalUserand, in a response to aGETObjectAclrequest, appears as the CanonicalUser.- By URI:
<grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group"><uri><>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<>``</uri></grantee>
To enable logging, you use LoggingEnabled and its children request
elements. To disable logging, you use an empty BucketLoggingStatus
request element:
<bucketloggingstatus xmlns="http://doc.s3.amazonaws.com/2006-03-01"></bucketloggingstatus>
For more information about server access logging, see Server Access Logging in the Amazon S3 User Guide.
For more information about creating a bucket, see CreateBucket. For more information about returning the logging status of a bucket, see GetBucketLogging.
The following operations are related to PutBucketLogging:
Warning
You must URL encode any signed header values that contain spaces. For
example, if your header value is my file.txt, containing two spaces
after my, you must URL encode this value to my%20%20file.txt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
PutBucketLoggingOutput
|
An instance of |
Input¶
Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.
Model¶
PutBucketLoggingInput
dataclass
¶
Bases: _SerdeShape
Dataclass for PutBucketLoggingInput structure.
Attributes¶
bucket
class-attribute
instance-attribute
¶
bucket: str | None = ...
The name of the bucket for which to set the logging parameters.
bucket_logging_status
class-attribute
instance-attribute
¶
bucket_logging_status: BucketLoggingStatus | None = ...
Container for logging status information.
checksum_algorithm
class-attribute
instance-attribute
¶
checksum_algorithm: str | None = ...
Indicates the algorithm used to create the checksum for the request when
you use the SDK. This header will not provide any additional
functionality if you don't use the SDK. When you send this header,
there must be a corresponding x-amz-checksum or x-amz-trailer header
sent. Otherwise, Amazon S3 fails the request with the HTTP status code
400 Bad Request. For more information, see Checking object
integrity
in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm parameter.
content_md5
class-attribute
instance-attribute
¶
content_md5: str | None = ...
The MD5 hash of the PutBucketLogging request body.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
expected_bucket_owner
class-attribute
instance-attribute
¶
expected_bucket_owner: str | None = ...
The account ID of the expected bucket owner. If the account ID that you
provide does not match the actual owner of the bucket, the request fails
with the HTTP status code 403 Forbidden (access denied).
Dictionaries¶
PutBucketLoggingInputDict
¶
Bases: TypedDict
Dictionary form of PutBucketLoggingInput.
Attributes¶
bucket
instance-attribute
¶
The name of the bucket for which to set the logging parameters.
bucket_logging_status
instance-attribute
¶
bucket_logging_status: Required[BucketLoggingStatus | BucketLoggingStatusDict]
Container for logging status information.
checksum_algorithm
instance-attribute
¶
checksum_algorithm: str | None
Indicates the algorithm used to create the checksum for the request when
you use the SDK. This header will not provide any additional
functionality if you don't use the SDK. When you send this header,
there must be a corresponding x-amz-checksum or x-amz-trailer header
sent. Otherwise, Amazon S3 fails the request with the HTTP status code
400 Bad Request. For more information, see Checking object
integrity
in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm parameter.
Output¶
PutBucketLoggingOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for PutBucketLoggingOutput structure.