GetBucketLogging
Returns the logging status of a bucket and the permissions users have to view and modify that status.
Description
The GetBucketLogging
operation returns the logging status of a bucket and the permissions users have to view and modify that status. To use this operation, you must be the bucket owner or have the appropriate permissions.
Server access logging provides detailed records for the requests that are made to a bucket. The logs contain information such as:
- The request type
- The resources that are requested
- The time and date of the request
- The requester
- The response status
note
- To use this operation, you must have permission to perform the
s3:GetBucketLogging
action. - You must be the bucket owner to use this operation.
- If logging is not enabled on the bucket, the response will include an empty
BucketLoggingStatus
element. - This operation is not supported for directory buckets.
Request Syntax
GET /?logging HTTP/1.1
Host: BucketName.qstorage.quilibrium.com
x-amz-expected-bucket-owner: OwnerAccountId
Values in italics indicate user input and should be replaced with actual values.
This operation does not have a request body.
Request Parameters
Headers
Name | Description | Required | Type |
---|---|---|---|
x-amz-expected-bucket-owner | 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). | No | text |
Examples
Example 1: Get bucket logging configuration when logging is enabled
GET /?logging HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
x-amz-id-2: Example7qoYGN7uMuFuYS6m7a4l
x-amz-request-id: TX234S0F24A06C7
Date: Wed, 01 Mar 2024 12:00:00 GMT
<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LoggingEnabled>
<TargetBucket>my-logging-bucket</TargetBucket>
<TargetPrefix>logs/</TargetPrefix>
<TargetGrants>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail">
<EmailAddress>user@example.com</EmailAddress>
</Grantee>
<Permission>READ</Permission>
</Grant>
</TargetGrants>
</LoggingEnabled>
</BucketLoggingStatus>
Values in italics indicate variable response values.
Example 2: Get bucket logging configuration when logging is disabled
GET /?logging HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
x-amz-id-2: Example7qoYGN7uMuFuYS6m7a4l
x-amz-request-id: TX234S0F24A06C7
Date: Wed, 01 Mar 2024 12:00:00 GMT
<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/>
Values in italics indicate variable response values.
Response Syntax
HTTP/1.1 200 OK
x-amz-id-2: RequestId
x-amz-request-id: AmazonRequestId
Date: ISO8601Date
<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LoggingEnabled>
<TargetBucket>TargetBucket</TargetBucket>
<TargetPrefix>TargetPrefix</TargetPrefix>
<TargetGrants>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="GranteeType">
<ID>GranteeID</ID>
<DisplayName>GranteeName</DisplayName>
<EmailAddress>GranteeEmail</EmailAddress>
<URI>GranteeURI</URI>
</Grantee>
<Permission>Permission</Permission>
</Grant>
</TargetGrants>
</LoggingEnabled>
</BucketLoggingStatus>
Values in italics indicate variable response values.