edit-icon download-icon

Set logging

Last Updated: May 14, 2018

You can enable or disable logging for a bucket through the console. You can store logs in the same logging-enabled bucket or a new bucket. For more information about the bucket logging format, see Set access logging.

Procedure

  1. Log on to the OSS console.

  2. On the bucket list on the left, click the bucket you want to enable logging for to open the overview page of the bucket, as shown in the following figure:


    bucket overview

  3. Click the Basic Settings tab, and click Edit in the Logs area, as shown in the following figure:


    Logs1

  4. Edit the logging settings as follows:

    • If you do not want to store logs on OSS, disable the Enable Log Storage switch, as shown in the following figure:


      log storage

    • If you want to store logs on OSS, do as follows:

      1. Enable the Enable Log Storage switch, as shown in the following figure:


        Log switch

      2. In the Log Storage Location drop-down box, select the name of a bucket to store the logs.


        Log storage

        Note: Only buckets of the same user and region can be selected.

      3. In the Log Prefix text box, use the default log prefix oss-accesslog/ or enter another prefix (<TargetPrefix> described in the following logging naming conventions), and click Save, as shown in the following figure:


        Prefix

Logging naming conventions

The following is the naming conventions for access log records:<TargetPrefix><SourceBucket>YYYY-MM-DD-HH-MM-SS-<UniqueString>

  • <TargetPrefix>: indicates the log prefix specified by the user.
  • <SourceBucket>: indicates the name of the source bucket.
  • YYYY-MM-DD-HH-MM-SS: indicates the time when the log is created, in which YYYY indicates the year, MM indicates the month, DD indicates the day, HH indicates the hour, MM indicates the minute, and SS indicates the second.
  • <UniqueString>: indicates the string generated by OSS.

An example object name used to store OSS access logs is as follows:
MyLog-OSS-example2015-09-10-04-00-00-0000
In the preceding example, MyLog is the log prefix specified by the user, oss-example is the name of the source bucket, 2015-09-10-04-00-00 is the log creation time, and 0000 is the string generated by the OSS.

Thank you! We've received your feedback.