Access logs record requests made to an S3-compatible storage Space. They help you investigate storage activity, troubleshoot access issues, and understand how files are being accessed.
In Cyberin S3 Object Storage, access logging can record requests such as reading, uploading, and deleting objects. Logs can also capture requests made through supported CDN endpoints when the CDN is enabled.
Access logs are useful when you need to investigate unexpected file access, review request activity, or analyze traffic to files served from object storage.
Choose two Spaces:
Source Space: The Space you want to record access activity for.
Destination Space The space where the generated log files will be saved.
For example, you might monitor website-assets and store its logs in website-access-logs.
In the below commands, use your real Space names. The Space destination should be private and accessible only to authorised users.
Use the endpoint of the region your Space is in.
For example, if your Space is in the sgp1 region, use:
https://sgp1.digitaloceanspaces.comReplace sgp1 with your actual region.
Ensure that the AWS CLI is configured with valid S3-compatible credentials before proceeding. Do not include your secret key directly in command examples or publish it in scripts.
Create a file named logging-config.json containing the following configuration:
{
"LoggingEnabled": {
"TargetBucket": "YOUR_LOG_SPACE_NAME",
"TargetPrefix": "access-logs/"
}
}Replace YOUR_LOG_SPACE_NAME with the name of the destination Space.
The configuration fields serve the following purposes:
TargetBucket: Specifies the destination Space where logs will be stored.
TargetPrefix: Specifies the prefix used to organize log files in the destination Space.
For example, access-logs/ groups the generated log objects under a common prefix.
To apply the logging configuration, run the following AWS CLI command:
aws --endpoint-url https://YOUR_REGION.digitaloceanspaces.com \
s3api put-bucket-logging \
--bucket YOUR_SOURCE_SPACE_NAME \
--bucket-logging-status file://logging-config.jsonReplace YOUR_REGION and YOUR_SOURCE_SPACE_NAME with the appropriate values.
On success, the CLI typically outputs nothing and exits with a status of zero.
This enables logging of access to the source Space. It does not immediately generate a log file . Once requests have been logged , the delivery of the logs is asynchronous .
Use the following command to check whether logging is enabled:
aws --endpoint-url https://YOUR_REGION.digitaloceanspaces.com \
s3api get-bucket-logging \
--bucket YOUR_SOURCE_SPACE_NAMEIf logging is enabled, the response should include a LoggingEnabled section that includes the destination Space and log prefix.
For example:
{
"LoggingEnabled": {
"TargetBucket": "YOUR_LOG_SPACE_NAME",
"TargetPrefix": "access-logs/"
}
}Make sure that the Space and prefix set are the intended ones to be configured.
Once logging is enabled, allow the service some time to collect and deliver the logs.
Then:
In the destination, open the Cyberin S3 Object Storage dashboard and open the Space.
Obtain the log prefix that you have configured, for example, access-logs/.
Search for new generated log objects.
Retrieve a log file and perform analysis.
Examine the recorded requests for relevant timestamps, object paths, response information, and other request details as available.
Log delivery async. Usually logs arrive within an hour, but can take two hours or longer to deliver. Just because you don’t have a log file right after you enable logging doesn’t mean there’s a problem with your configuration.
Origin access logs are in the Amazon S3 server access log format. CDN access logs are in the format of Amazon CloudFront access logs.
To stop logging requests, run the command:
aws --endpoint-url https://YOUR_REGION.digitaloceanspaces.com \
s3api put-bucket-logging \
--bucket YOUR_SOURCE_SPACE_NAME \
--bucket-logging-status '{}'This removes the source Space logging configuration.
Run the get-bucket-logging command again to confirm that logging is disabled. An empty JSON response means no logging configuration set.
Turning off logging does not automatically delete log files already stored in the destination Space.
Access denied when enabling logging: Check your access key's permissions. Configuring access logs requires the appropriate bucket-level permissions, and the destination Space must allow the service to write log objects.
No log files appear: Allow sufficient time for asynchronous delivery. Confirm the destination Space, target prefix, regional endpoint, and logging configuration.
The source and destination Space are the same: Use a separate destination Space. Sending access logs to the source Space is not supported.
The configuration command fails: Check that the JSON file is valid, the file path is correct, and the source Space name and endpoint match your configuration.
CDN requests are not easy to identify: Review the appropriate log format. Origin and CDN logs use different formats, and they may be stored under the same destination prefix when CDN logging is enabled.