Set bucket logging

Stay organized with collections Save and categorize content based on your preferences.

By default, buckets do not have logging enabled. To set or modify logging configuration for an existing bucket you make a PUT request that is scoped to the bucket and you use the logging query string parameter. You must include an XML document in the request body that contains the logging configuration. Notice that you cannot set logging configuration on a new bucket that you are creating.

You must have FULL_CONTROL permission to set or modify logging configuration for an existing bucket. Also, you must be authenticated to use the PUT Bucket method.

Query string parameters

Parameter Description Required
logging You use this to change the logging configuration on an existing bucket. You must provide the Logging document in the request body. No

See signed URL query string parameters for information on the parameters you include when creating and using signed URLs.

Request headers

See common request headers.

Request body elements

The following request body elements are applicable only if you use the logging query string parameter to specify logging configuration for an existing bucket.

Element Description
Logging Container for logging configuration. Use an empty element (for example, <Logging/>) to disable logging for the bucket.
LogBucket The bucket that will receive log objects. Must be a valid bucket name. Required.
LogObjectPrefix The object prefix for log objects. It can be at most 900 characters and must be a valid object name. Optional.

Request syntax

PUT /?logging HTTP/1.1
Date: DATE


Response headers

The request can return a variety of response headers depending on the request headers you use.

Response body elements

The response does not include an XML document in the response body.


The following sample enables Logging for a bucket named


PUT / HTTP/1.1
Content-Length: 148
Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg

<?xml version="1.0" encoding="UTF-8"?>


HTTP/1.1 200 OK
Date: Thu, 12 Mar 2012 03:38:42 GMT
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html