Updated on 2024-03-04 GMT+08:00

Configuring Access Logging for a Bucket

After logging is enabled for a bucket, OBS automatically converts bucket logs into objects following the naming rules and writes the objects into a target bucket.

Procedure

  1. In the bucket list, click the bucket you want to operate. The Overview page is displayed.
  2. In the Basic Configurations area, click Logging. The Logging dialog box is displayed.
  3. Select Enable.
  4. Select an existing bucket where you want to store log files. Log delivery users of the selected bucket will be automatically granted the permissions to read the bucket ACL and write logs to the bucket.
  5. Enter a prefix for the Log File Name Prefix.

    After logging is enabled, generated logs are named in the following format:

    <Log File Name Prefix>YYYY-mm-DD-HH-MM-SS-<UniqueString>

    • <Log File Name Prefix> is the shared prefix of log file names.
    • YYYY-mm-DD-HH-MM-SS indicates when the log is generated.
    • <UniqueString> indicates a character string generated by OBS.

    On OBS Console, if the configured <Log File Name Prefix> ends with a slash (/), logs generated in the bucket are stored in the <Log File Name Prefix> folder in the bucket, facilitating the management of log files.

    Example:

    • If the bucket named bucket is used to save log files, and the log file name prefix is set to bucket-log/, all log files delivered to this bucket are saved in the bucket-log folder. A log file is named as follows: 2015-06-29-12-22-07-N7MXLAF1BDG7MPDV.
    • If the bucket named bucket is used to save log files, and the log file name prefix is set to bucket-log, all log files are saved in the root directory of the bucket. A log file is named as follows: bucket-log2015-06-29-12-22-07-N7MXLAF1BDG7MPDV.

  6. Click OK.

    After logging is configured, you can view operation logs in the bucket that stores the logs in approximately fifteen minutes.

Related Operations

If you do not need to record logs, click Disable in the Logging dialog box and then click OK. After logging is disabled, logs are not recorded, but existing logs in the target bucket will be retained.