Skip to content
v2.277.0

LoggingConfigurationProperty Struct ​

Describes where logs are stored and the prefix that Amazon S3 assigns to all log object keys for a bucket.

For examples and more information, see PUT Bucket logging in the Amazon S3 API Reference .

To successfully complete the AWS::S3::Bucket LoggingConfiguration request, you must have s3:PutObject and s3:PutObjectAcl in your IAM permissions.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';

declare const simplePrefix: any;
const loggingConfigurationProperty: s3.CfnBucket.LoggingConfigurationProperty = {
  destinationBucketName: 'destinationBucketName',
  logFilePrefix: 'logFilePrefix',
  targetObjectKeyFormat: {
    partitionedPrefix: {
      partitionDateSource: 'partitionDateSource',
    },
    simplePrefix: simplePrefix,
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3

# simple_prefix: Any

logging_configuration_property = s3.CfnBucket.LoggingConfigurationProperty(
    destination_bucket_name="destinationBucketName",
    log_file_prefix="logFilePrefix",
    target_object_key_format=s3.CfnBucket.TargetObjectKeyFormatProperty(
        partitioned_prefix=s3.CfnBucket.PartitionedPrefixProperty(
            partition_date_source="partitionDateSource"
        ),
        simple_prefix=simple_prefix
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;

Object simplePrefix;

LoggingConfigurationProperty loggingConfigurationProperty = LoggingConfigurationProperty.builder()
        .destinationBucketName("destinationBucketName")
        .logFilePrefix("logFilePrefix")
        .targetObjectKeyFormat(TargetObjectKeyFormatProperty.builder()
                .partitionedPrefix(PartitionedPrefixProperty.builder()
                        .partitionDateSource("partitionDateSource")
                        .build())
                .simplePrefix(simplePrefix)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;

var simplePrefix;

var loggingConfigurationProperty = new LoggingConfigurationProperty {
    DestinationBucketName = "destinationBucketName",
    LogFilePrefix = "logFilePrefix",
    TargetObjectKeyFormat = new TargetObjectKeyFormatProperty {
        PartitionedPrefix = new PartitionedPrefixProperty {
            PartitionDateSource = "partitionDateSource"
        },
        SimplePrefix = simplePrefix
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var simplePrefix interface{}

loggingConfigurationProperty := &LoggingConfigurationProperty{
	DestinationBucketName: jsii.String("destinationBucketName"),
	LogFilePrefix: jsii.String("logFilePrefix"),
	TargetObjectKeyFormat: &TargetObjectKeyFormatProperty{
		PartitionedPrefix: &PartitionedPrefixProperty{
			PartitionDateSource: jsii.String("partitionDateSource"),
		},
		SimplePrefix: simplePrefix,
	},
}

Properties ​

destinationBucketNameoptionalstringdestination_bucket_nameoptionalstrdestinationBucketNameoptionalStringDestinationBucketNameoptionalstringDestinationBucketNameoptional*string#
The name of the bucket where Amazon S3 should store server access log files.

You can store log files in any bucket that you own. By default, logs are stored in the bucket where the LoggingConfiguration property is defined.

logFilePrefixoptionalstringlog_file_prefixoptionalstrlogFilePrefixoptionalStringLogFilePrefixoptionalstringLogFilePrefixoptional*string#
A prefix for all log object keys.

If you store log files from multiple Amazon S3 buckets in a single bucket, you can use a prefix to distinguish which log files came from which bucket.

targetObjectKeyFormatoptionalIResolvable | CfnBucket.TargetObjectKeyFormatPropertytarget_object_key_formatoptionaltyping.Union[IResolvable, TargetObjectKeyFormatProperty]targetObjectKeyFormatoptionalIResolvableTargetObjectKeyFormatoptionalIResolvableTargetObjectKeyFormatoptionalinterface{}#
Amazon S3 key format for log objects.

Only one format, either PartitionedPrefix or SimplePrefix, is allowed.