logging
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.
Usage notes
-
If the source bucket has a region attribute, the target bucket must belong to the same account and region. It can be the same as or different from the source bucket.
When the source and target buckets are the same, the log push operation generates additional logs, which creates a loop. Use different source and target buckets to avoid this.
-
For a source bucket without a region attribute, the target bucket must be the same as the source bucket.
-
Log files can take up to 48 hours to generate. Requests may appear in adjacent time period files, so logs for a specific period are not guaranteed to be complete or timely.
-
OSS generates a log file every hour until you disable logging. Delete unneeded log files to reduce storage costs.
Use Lifecycle rules based on the last modified time to periodically delete log files.
-
To prevent service disruption or data contamination when configuring log shipping for a bucket with OSS-HDFS enabled, do not set the Log Prefix to
.dlsdata/. -
OSS may append new fields to the end of logs as needed, so the list of fields can change over time. When you develop log processing tools, do not rely on a fixed number of fields or a fixed field order. Make sure that your tools can handle changes to the field list. For example, the Bucket ARN field was added to logs starting September 17, 2025. The RelatedArn and TableId fields were added later.
-
Avoid delivering logs to a bucket with ObjectWorm enabled. ObjectWorm prevents log deletion during the retention period, causing storage costs to increase steadily.
Log file naming
Log files use the following naming convention. The source bucket part of the file name depends on the bucket type:
When the source bucket is a regular bucket:
<TargetPrefix><SourceBucket>YYYY-mm-DD-HH-MM-SS-UniqueString
When the source bucket is a table bucket:
<TargetPrefix><TableBucketARN>YYYY-mm-DD-HH-MM-SS-UniqueString
|
Parameter |
Description |
|
TargetPrefix |
The prefix for the log file name. |
|
SourceBucket |
The source bucket that generates access logs. |
|
TableBucketARN |
The ARN of the OSS Table Bucket. When the source bucket is a table bucket, the source bucket part of the log file name is the ARN of the table bucket, in the format of acs:osstables:<region>:<Alibaba Cloud account ID>:bucket/<table bucket name>. When the source bucket is a regular bucket, this part is the value of SourceBucket. |
|
YYYY-mm-DD-HH-MM-SS |
The timestamp in year, month, day, hour, minute, and second format. Logs use hourly granularity: HH=01 covers 01:00:00 to 01:59:59. MM and SS are always 00. |
|
UniqueString |
A system-generated unique identifier for the log file. |