How to Configure DigitalOcean Spaces Access Logs
Last verified 25 Nov 2026
Spaces Object Storage is an S3-compatible service for storing and serving large amounts of data. The built-in Spaces CDN minimizes page load times, improves performance, and reduces bandwidth and infrastructure costs.
Spaces can generate access logs that record requests to a bucket for monitoring, auditing, and troubleshooting.
Access logs can include:
- Reads, writes, and deletions of objects in the bucket.
- Requests to origin endpoints.
- Requests to the bucket’s CDN endpoints, if enabled.
Spaces access logs use Amazon S3 server access log format, and CDN access logs use Amazon CloudFront access log format.
Spaces delivers access logs asynchronously, usually within one hour of activity, though delivery can take two hours or longer.
You can enable or disable access logs using the S3-compatible API, such as the AWS CLI, or with Terraform.
Check the Status of Access Logs
Access logs are disabled by default. To check whether access logs are enabled, go to the Buckets tab of the Spaces Object Storage page, and then select the bucket you want to view.
Click the Settings tab. In the Access Logs section, check whether access logs are Enabled or Disabled.
Then, in the Buckets tab, find and select the bucket you want to view.
Then, click the Settings tab, in the Access Logs section, check whether access logs are Enabled or Disabled.
Manage Access Logs Using the AWS CLI
You can enable or disable access logs using the S3-compatible API with the AWS CLI (aws).
Configure AWS CLI Credentials
Before configuring access logs, create a full-access Spaces access key, and then securely save its access key ID and secret key.
Configuring access logs requires a full-access key to perform bucket logging operations on the source bucket. Limited-access keys cannot perform these operations, even if they have permissions on both the source and destination buckets.
To read the delivered log objects, you can use a limited-access key with read permissions on the destination bucket.
Configure the AWS CLI with your Spaces credentials:
aws configureWhen prompted, enter your Spaces access key ID and secret key. The AWS CLI stores these credentials in ~/.aws/credentials on Linux and macOS. By default, subsequent AWS CLI commands use these credentials unless another profile or credential source is specified.
Enable Access Logs
Create a JSON file that defines the logging configuration. Specify the destination bucket where logs are stored and the prefix used for log objects.
The destination bucket must be different from the source bucket because Spaces doesn’t support writing access logs to the same bucket that generates them. Both buckets must be in the same region.
{
"LoggingEnabled": {
"TargetBucket": "use_your_destination_bucket",
"TargetPrefix": "example_log_prefix/"
}
}Then, apply the configuration:
aws --endpoint-url https://use_your_region.digitaloceanspaces.com \
s3api put-bucket-logging \
--bucket use_your_source_bucket \
--bucket-logging-status file://use_your_logging_config_path.jsonIf the command succeeds, it returns no output and exits with code 0. If needed, verify that access logs are enabled.
Disable Access Logs
To disable access logs, send an empty logging configuration. This removes the LoggingEnabled section.
aws --endpoint-url https://use_your_region.digitaloceanspaces.com \
s3api put-bucket-logging \
--bucket use_your_source_bucket \
--bucket-logging-status '{}'After running this command, verify that access logs are disabled.
Verify Your Logging Configuration
Check the current logging configuration:
aws --endpoint-url https://use_your_region.digitaloceanspaces.com \
s3api get-bucket-logging \
--bucket use_your_source_bucketIf logging is enabled, the response includes a LoggingEnabled object with your destination bucket and prefix:
{
"LoggingEnabled": {
"TargetBucket": "your-log-bucket",
"TargetPrefix": "example_log_prefix/"
}
}If logging is disabled, the response is an empty JSON object.
Manage Access Logs Using Terraform
You can also configure access logs with Terraform using the digitalocean_spaces_bucket_logging resource.
The destination bucket must be different from the source bucket, and both buckets must be in the same region.
As with the AWS CLI, configuring access logs with Terraform requires a full-access Spaces access key. Limited-access keys cannot configure access logs, even if they have permissions on both buckets.