Accessing OSS generates numerous access logs. You can use the log storage feature to save these logs to a specified bucket. The logs are stored as log files that are generated hourly and follow a fixed naming convention.
Precautions
To enable log storage for a bucket, you must have the oss:PutBucketLogging permission. To view the log storage configuration, you must have the oss:GetBucketLogging permission. To disable log storage, you must have the oss:DeleteBucketLogging permission. For more information, see Grant custom access policies to a Resource Access Management (RAM) user.
Method definitions
Enable log storage
put_bucket_logging(request: PutBucketLoggingRequest, **kwargs) → PutBucketLoggingResult
View the log storage configuration
get_bucket_logging(request: GetBucketLoggingRequest, **kwargs) → GetBucketLoggingResult
Disable log storage
delete_bucket_logging(request: DeleteBucketLoggingRequest, **kwargs) → DeleteBucketLoggingResult
Request parameters
|
Parameter name |
Type |
Description |
|
request |
PutBucketLoggingRequest |
The request parameters. For more information, see PutBucketLoggingRequest |
|
GetBucketLoggingRequest |
The request parameters. For more information, see GetBucketLoggingRequest |
|
|
DeleteBucketLoggingRequest |
The request parameters. For more information, see DeleteBucketLoggingRequest |
Return values
|
Type |
Description |
|
PutBucketLoggingResult |
The return value. For more information, see PutBucketLoggingResult |
|
GetBucketLoggingResult |
The return value. For more information, see GetBucketLoggingResult |
|
DeleteBucketLoggingResult |
The return value. For more information, see DeleteBucketLoggingResult |
For the complete definition of the operation to enable log storage, see put_bucket_logging.
For the complete definition of the operation to view the log storage configuration, see get_bucket_logging.
For the complete definition of the operation to disable log storage, see delete_bucket_logging
Code examples
References
-
For complete sample code that shows how to enable log storage for a vector bucket, see put_bucket_logging.py.
-
For complete sample code that shows how to retrieve the log storage configuration of a vector bucket, see get_bucket_logging.py.
-
For complete sample code that shows how to delete the log storage configuration for a vector bucket, see delete_bucket_logging.py.