Setting Logging

Last updated: 2021-09-30 12:29:05

    Overview

    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.

    Note:

    • 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.

    Directions

    1. Log in to the COS console.
    2. Click Bucket List in the left sidebar.
    3. Click the source bucket that you want to enable Logging for.
    4. Click Logging > Logging. Then, click Edit and enable Status.
    5. 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.
    6. Click Save.
      Note:

      It takes several minutes or longer for the logs to be generated and delivered to the destination bucket.

    7. Go to the destination bucket configured to view the generated logs.
    8. After downloading the logs, you can view them in detail. For more information, please see Log Management Overview.

    Notes

    1. 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.
    2. If Logging is disabled but the role is not deleted, its read/write permissions to the source bucket’s logs will be retained.