• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. User Guide (S3cmd)
  4. Operation Guide
  5. Bucket Management
  6. Configuring Logging

Configuring Logging

By default, creating a bucket does not generate operation logs. If you want to record a bucket's operation logs, enable the logging function for this bucket. The bucket owner can configure logging.

Procedure

  1. Open the command line tool.
  2. Run the following command to enable logging for a specific bucket:

    s3cmd accesslog --access-logging-target-prefix=log-target-prefix s3://my-bucket

    NOTE:

    log-target-prefix is the path with a specified prefix that stores logs and uses the S3 URI format. For example, s3://examplebucket/logs indicates that logs are stored in bucket examplebucket and log file names are prefixed with logsmy-bucket specifies the bucket for which logging is enabled.

    If the following information is displayed in the command output, it indicates that logging is successfully enabled:

    Access logging for: s3://my-bucket/
       Logging Enabled: True
         Target prefix: log-target-prefix

Follow-up Procedure

You can disable logging for the bucket as follows if necessary:

  1. Open the command line tool.
  2. Run the following command to disable logging for the bucket:

    s3cmd accesslog --no-access-logging s3://my-bucket

    If the following information is displayed in the command output, it indicates that logging is successfully enabled:

    Access logging for: s3://my-bucket/
       Logging Enabled: False