This document provides an overview of APIs and SDK code samples related to log management.
API | Operation Name | Operation Description |
---|---|---|
PUT Bucket logging | Setting log management | Enables logging for the source bucket |
GET Bucket logging | Querying log management | Queries the logging configuration information of the source bucket |
This API (PUT Bucket logging) is used to enable logging for the source bucket and store its access logs in a specified destination bucket.
put_bucket_logging(Bucket, BucketLoggingStatus={}, **kwargs):
response = client.put_bucket_logging(
Bucket='examplebucket-1250000000',
BucketLoggingStatus={
'LoggingEnabled': {
'TargetBucket': 'logging-bucket-1250000000',
'TargetPrefix': 'string'
}
}
)
Parameter Name | Description | Type | Required |
---|---|---|---|
Bucket | Source bucket for which to enable the logging feature in the format of BucketName-APPID . For more information, please see Naming Convention |
String | Yes |
TargetBucket | Destination bucket where to store logs in the format of BucketName-APPID . For more information, please see Naming Convention |
String | Yes |
TargetPrefix | Specified path prefix in the destination bucket for storing logs | String | Yes |
The returned value of this method is None.
This API (GET Bucket logging) is used to query the log configuration information of a specified bucket.
get_bucket_logging(Bucket, **kwargs):
response = client.get_bucket_logging(
Bucket='examplebucket-1250000000'
)
Parameter Name | Description | Type | Required |
---|---|---|---|
Bucket | Destination bucket where to store logs in the format of BucketName-APPID . For more information, please see Naming Convention |
String | Yes |
Log management configuration of the bucket in dict type.
{
'LoggingEnabled': {
'TargetBucket': 'logging-bucket-1250000000',
'TargetPrefix': 'string'
}
}
Parameter Name | Description | Type |
---|---|---|
TargetBucket | Destination bucket where to store logs in the format of BucketName-APPID . For more information, please see Naming Convention |
String |
TargetPrefix | Specified path prefix in the destination bucket for storing logs | String |
Was this page helpful?