# LoggingConfigurationProperty

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](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) 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.

- Source: Generated at build time
- Type last changed: v2.112.0 · 1 Dec 2023

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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
    }
};
```

Golang:

```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

- `destinationBucketName`: 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.

- `logFilePrefix`: 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.

- `targetObjectKeyFormat`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnBucket.TargetObjectKeyFormatProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.CfnBucket.TargetObjectKeyFormatProperty.html) — Amazon S3 key format for log objects.

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