interface AwsLogDriverProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECS.AwsLogDriverProps |
Java | software.amazon.awscdk.services.ecs.AwsLogDriverProps |
Python | aws_cdk.aws_ecs.AwsLogDriverProps |
TypeScript (source) | @aws-cdk/aws-ecs » AwsLogDriverProps |
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
Name | Type | Description |
---|---|---|
stream | string | Prefix for the log streams. |
datetime | string | This option defines a multiline start pattern in Python strftime format. |
log | ILog | The log group to log to. |
log | Retention | The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct. |
mode? | Aws | The delivery mode of log messages from the container to awslogs. |
multiline | string | This option defines a multiline start pattern using a regular expression. |
streamPrefix
Type:
string
Prefix for the log streams.
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
datetimeFormat?
Type:
string
(optional, default: No multiline matching.)
This option defines a multiline start pattern in Python strftime format.
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.
logGroup?
Type:
ILog
(optional, default: A log group is automatically created.)
The log group to log to.
logRetention?
Type:
Retention
(optional, default: Logs never expire.)
The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct.
mode?
Type:
Aws
(optional, default: AwsLogDriverMode.BLOCKING)
The delivery mode of log messages from the container to awslogs.
multilinePattern?
Type:
string
(optional, default: No multiline matching.)
This option defines a multiline start pattern using a regular expression.
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.