When you access Object Storage Service (OSS), a large number of access logs are generated. You can enable logging to facilitate log queries. After you enable and configure logging for a bucket, OSS generates an object on an hourly basis based on the predefined naming conventions. This way, access logs are written as objects to a specified bucket.

Prerequisites

At least one AccessKey pair is enabled in your account.

For more information about how to create an AccessKey pair, see Create an AccessKey pair for a RAM user.

Procedure

  1. Log on to the OSS console.
  2. Click Buckets, and then click the name of the target bucket.
  3. In the left-side navigation pane, choose Logging > Logging.
  4. Click Configure. Set Destination Bucket and Log Prefix.
    • Destination Bucket: Select a bucket name from the Destination Bucket drop-down list. You can only select a bucket that is located in the same region as the bucket for which logging is enabled under the same Alibaba Cloud account.
    • Log Prefix: Enter the path and prefix of the logs. If you configure this parameter, the log objects are stored in the specified directory of the destination bucket. If you do not configure this parameter, the log objects are stored in the root directory of the destination bucket. For example, if you enter log/ in Log Prefix, the logs are stored in the log/ directory.
    Note For more information about the format of access logs and log object naming conventions, see Logging.
  5. Click Save.