COS introduces the Logging feature to record request logs related to bucket operations, facilitating bucket usage and management. You can enable it in the COS console. For more information, please see Log Management Overview.
- Currently, Logging is only available for the Beijing, Shanghai, Guangzhou, Nanjing, Chongqing, Chengdu, Hong Kong (China), Singapore, Toronto, Silicon Valley, and Mumbai regions.
- Currently, only the bucket owner has permission to set Logging, and other users cannot see the Logging configuration item in the console.
- Logs are delivered once every 5 minutes and are not 100% accurate. Therefore, they are for reference only and cannot be used for usage measurement and billing.
- Log in to the COS console.
- Click Bucket List in the left sidebar.
- Click the source bucket that you want to enable Logging for.
- Click Logging > Logging. Then, click Edit and enable Status.
- Configure the configuration items of Logging as follows:
- Destination Bucket: The destination bucket that stores the source bucket’s logs must reside in the same region as the source bucket. You are not advised to set the source bucket itself as the destination bucket.
- Path Prefix: a custom path prefix for the logs. If this field is left empty, logs will be delivered to the root directory of the destination bucket.
- Service Authorization: CLS needs to be authorized to deliver logs to your bucket.
- Click Save.
It takes several minutes or longer for the logs to be generated and delivered to the destination bucket.
- Go to the destination bucket configured to view the generated logs.
- After downloading the logs, you can view them in detail. For more information, please see Log Management Overview.
- To enable Logging, you need to create a log role in the CAM console and grant the role permissions to read/write logs of the source bucket.
- If Logging is disabled but the role is not deleted, its read/write permissions to the source bucket’s logs will be retained.