AwsLogDriverProps Struct
Specifies the awslogs log driver configuration options.
Example
// Create a Task Definition for the Windows container to start
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', {
runtimePlatform: {
operatingSystemFamily: ecs.OperatingSystemFamily.WINDOWS_SERVER_2019_CORE,
cpuArchitecture: ecs.CpuArchitecture.X86_64,
},
cpu: 1024,
memoryLimitMiB: 2048,
});
taskDefinition.addContainer('windowsservercore', {
logging: ecs.LogDriver.awsLogs({ streamPrefix: 'win-iis-on-fargate' }),
portMappings: [{ containerPort: 80 }],
image: ecs.ContainerImage.fromRegistry('mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019'),
});
Properties
datetimeFormatoptionalstringdatetime_formatoptionalstrdatetimeFormatoptionalStringDatetimeFormatoptionalstringDatetimeFormatoptional*string#Default: No multiline matching.
A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages.
logGroupoptionalILogGroupReflog_groupoptionalILogGroupReflogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRef#Default: A log group is automatically created.
logRetentionoptionalRetentionDayslog_retentionoptionalRetentionDayslogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDays#Default: Logs never expire.
maxBufferSizeoptionalSizemax_buffer_sizeoptionalSizemaxBufferSizeoptionalSizeMaxBufferSizeoptionalSizeMaxBufferSizeoptionalSize#Default: 1 megabyte if driver mode is non-blocking, otherwise this property is not set
modeoptionalAwsLogDriverModemodeoptionalAwsLogDriverModemodeoptionalAwsLogDriverModeModeoptionalAwsLogDriverModeModeoptionalAwsLogDriverMode= AwsLogDriverMode.BLOCKING#multilinePatternoptionalstringmultiline_patternoptionalstrmultilinePatternoptionalStringMultilinePatternoptionalstringMultilinePatternoptional*string#Default: No multiline matching.
A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages.
This option is ignored if datetimeFormat is also configured.
notes
The awslogs-stream-prefix option allows you to associate a log stream with the specified prefix, the container name, and the ID of the Amazon ECS task to which the container belongs. If you specify a prefix with this option, then the log stream takes the following format:
prefix-name/container-name/ecs-task-id