Accessing OSS generates numerous access logs. You can enable logging to store these logs in a specified CloudBox bucket. Log files are generated hourly and follow a fixed naming convention. You can then analyze the stored logs by using tools such as Simple Log Service or by building a Spark cluster.
Prerequisites
-
OSS on CloudBox is available only in the China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Beijing), and China (Chengdu) regions.
-
You have purchased a CloudBox.
-
You have created a VPC and a vSwitch for the CloudBox.
-
You have contacted technical support to request a SingleTunnel network type for your CloudBox's VPC.
Notes
For a source bucket with a region attribute, the target bucket for logging can be the same as or different from the source bucket. However, the target bucket must be in the same region and belong to the same account.
When you configure logging for a source bucket, the log delivery operation itself generates new logs. If the source and target buckets are the same, the logging feature records and delivers these new logs, which causes a logging loop. We recommend using different source and target buckets.
If a source bucket does not have a region attribute, the target bucket for logging must be the same as the source bucket.
Log files are expected to be generated within 48 hours. A log file for a specific time period may not record all requests from that period. Some requests may appear in the log file of the previous or next time period. Therefore, the completeness and timeliness of log records for a specific time period are not guaranteed.
OSS generates a log file every hour until you disable logging. To reduce your storage costs, promptly delete log files that you no longer need.
You can use a lifecycle rule to periodically delete log files. For more information, see Lifecycle rule based on last modification time.
To avoid disrupting the OSS-HDFS service or causing data contamination, do not set the Log Prefix to
.dlsdata/when configuring a logging rule for an OSS-HDFS-enabled bucket.OSS may add fields to the end of logs as needed. Ensure your log processing tools are forward-compatible to handle new log fields. Effective September 17, 2025, the Bucket ARN field will be added to the log content.
We recommend against delivering logs to a bucket with ObjectWorm enabled. Log files are generated continuously. If ObjectWorm is enabled, log files within the retention period cannot be deleted, which can cause your storage costs to increase steadily.
Log file naming convention
Log files follow this naming convention:
<TargetPrefix><SourceBucket>YYYY-mm-DD-HH-MM-SS-UniqueStringParameter | Description |
TargetPrefix | The prefix for the log file name. |
SourceBucket | The name of the source bucket that generates access logs. |
YYYY-mm-DD-HH-MM-SS | The time partition of the log. From left to right, the fields represent the year, month, day, hour, minute, and second. Logs are stored on an hourly basis. For example, if |
UniqueString | A system-generated string that uniquely identifies the log file. |