Updated on 2026-01-19 GMT+08:00

Configuring Logging for a Bucket

When a bucket is accessed, OBS logs all the requests for the bucket. After logging is enabled for the bucket, OBS stores the logs either in the logged bucket or another bucket that belongs to the same account and region as the logged bucket. You can search and analyze these logs to trace and locate abnormal events. This section describes how to configure logging, verify the logging configuration, and disable logging for a bucket.

Configuring Logging for a Bucket

You can use OBS Console, APIs, or SDKs to configure logging for a bucket.

Verifying the Logging Configuration of a Bucket

After configuring logging for a bucket, you can use OBS Console, APIs, SDKs, or obsutil to verify the logging configuration. You can check whether OBS has generated log files and whether you have access to them.

Disabling Logging for a Bucket

Uploading and storing bucket logs will incur costs for PUT requests and storage. If you no longer need to record logs, disable logging for the bucket. After logging is disabled, OBS stops recording new logs, but existing logs in the log storage bucket will be retained.

You can use OBS Console to disable logging for a bucket.

References

Creating a Trust Agency for Uploading Logs

  1. In the Logging dialog box, click View Agencies to go to the Agencies page on the IAM console.
  2. Click Go to New Console. In the navigation pane of the new IAM console, choose Agencies.
  3. Click Create Trust Agency.
  4. Enter an agency name.
  5. Set Agency Type to Cloud service.
  6. Select Object Storage Service for Cloud Service.
  7. Choose a maximum session duration.
  8. Click OK.
  9. Click Authorize. For details about the authorization, see Creating an Agency for Uploading Logs.
  10. Go back to the Agencies page on the new IAM console.
  11. Search for the newly created agency and click Modify in the Operation column.
  12. Click the Trust Policy tab and then Edit Trust Policy. The trust policy is as follows:

    {
    	"Version": "5.0",
    	"Statement": [
    		{
    			"Action": [
    				"sts:agencies:assume",
    				"sts::tagSession"
    			],
    			"Effect": "Allow",
    			"Principal": {
    				"Service": [
    					"service.OBS"
    				]
    			}
    		}
    	]
    }

  13. Click OK to save the policy.