How to Configure Spaces Access Logs Public Preview

Spaces Object Storage is an S3-compatible object storage service. Spaces buckets let you store and serve large amounts of data, and the built-in CDN minimizes page load times and improves performance.


Now in public preview, Spaces buckets automatically generate detailed logs of reads, writes, and deletions of objects in your buckets. You can configure this feature using the S3 API. Using the PutBucketLogging S3 API requires an access key with “Full Access” permissions on all buckets.

Spaces access logs are designed to be delivered within an hour but may take as long as two hours or more.

To enable this feature, create a support ticket with the subject line “Spaces Access Logging” under the topic “Storage,” then “Spaces,” then “Other.”

Configure Access Logs

To configure access logs, use the following API call, replacing REGION with your bucket’s region and MY_SOURCE_BUCKET with your source bucket’s name (the origin of the logs):

aws --endpoint-url https://REGION.digitaloceanspaces.com \
        s3api put-bucket-logging \
        --bucket MY_SOURCE_BUCKET \
        --bucket-logging-status file://logging_config.json

The file logging_config.json allows you to set your target bucket name (where the logs are output) and target directory prefix, for example:

{
  "LoggingEnabled": {
    "TargetBucket": "my-destination-bucket",
    "TargetPrefix": "Logs/"
  }
}

Limits

  • You can only configure this feature using the S3-compatible Spaces API. You cannot configure this feature using the DigitalOcean Control Panel, DigitalOcean API, doctl, or Terraform.
  • Spaces Access Logs currently only supports origin endpoints for Spaces buckets. CDN endpoints for Spaces buckets is not supported.
In this article...