Skip to content
v2.274.0

TargetObjectKeyFormat Class ​

The key format for the log object.

Example ​

ts
const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket');

const bucket = new s3.Bucket(this, 'MyBucket', {
  serverAccessLogsBucket: accessLogsBucket,
  serverAccessLogsPrefix: 'logs',
  // You can use a simple prefix with `TargetObjectKeyFormat.simplePrefix()`, but it is the same even if you do not specify `targetObjectKeyFormat` property.
  targetObjectKeyFormat: s3.TargetObjectKeyFormat.simplePrefix(),
});

Initializer ​

ts
new TargetObjectKeyFormat()
python
TargetObjectKeyFormat()
java
new TargetObjectKeyFormat()
csharp
new TargetObjectKeyFormat()
go
NewTargetObjectKeyFormat()

Methods ​

partitionedPrefix(dateSource?: PartitionDateSource): TargetObjectKeyFormat // chainable@staticmethod def partitioned_prefix(date_source: typing.Optional[PartitionDateSource] = None) -> TargetObjectKeyFormatpublic static TargetObjectKeyFormat partitionedPrefix(PartitionDateSource dateSource)public static TargetObjectKeyFormat PartitionedPrefix(PartitionDateSource? dateSource = null)func PartitionedPrefix(DateSource PartitionDateSource) TargetObjectKeyFormatstatic#
Use partitioned prefix for log objects. If you do not specify the dateSource argument, the default is EventTime.

The partitioned prefix format as follow: [DestinationPrefix][SourceAccountId]/​[SourceRegion]/​[SourceBucket]/​[YYYY]/​[MM]/​[DD]/​[YYYY]-[MM]-[DD]-[hh]-[mm]-[ss]-[UniqueString]

simplePrefix(): TargetObjectKeyFormat // chainable@staticmethod def simple_prefix() -> TargetObjectKeyFormatpublic static TargetObjectKeyFormat simplePrefix()public static TargetObjectKeyFormat SimplePrefix()func SimplePrefix() TargetObjectKeyFormatstatic#
Use the simple prefix for log objects.

The simple prefix format as follow: [DestinationPrefix][YYYY]-[MM]-[DD]-[hh]-[mm]-[ss]-[UniqueString]