class LogDriver
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ECS.LogDriver |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#LogDriver |
Java | software.amazon.awscdk.services.ecs.LogDriver |
Python | aws_cdk.aws_ecs.LogDriver |
TypeScript (source) | aws-cdk-lib » aws_ecs » LogDriver |
Implemented by
Aws, Fire, Fluentd, Gelf, Generic, Journald, Json, Splunk, Syslog
Obtainable from
Log.awsLogs(), Log.firelens(), Log.fluentd(), Log.gelf(), Log.journald(), Log.jsonFile(), Log.splunk(), Log.syslog()
The base class for log drivers.
Example
// Create a Task Definition for the container to start
const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');
taskDefinition.addContainer('TheContainer', {
image: ecs.ContainerImage.fromRegistry('example-image'),
memoryLimitMiB: 256,
logging: ecs.LogDrivers.awsLogs({
streamPrefix: 'EventDemo',
mode: ecs.AwsLogDriverMode.NON_BLOCKING,
maxBufferSize: Size.mebibytes(25),
}),
});
Initializer
new LogDriver()
Methods
| Name | Description |
|---|---|
| bind(scope, containerDefinition) | Called when the log driver is configured on a container. |
| static aws | Creates a log driver configuration that sends log information to CloudWatch Logs. |
bind(scope, containerDefinition)
public bind(scope: Construct, containerDefinition: ContainerDefinition): LogDriverConfig
Parameters
- scope
Construct - containerDefinition
ContainerDefinition
Returns
Called when the log driver is configured on a container.
static awsLogs(props)
public static awsLogs(props: AwsLogDriverProps): LogDriver
Parameters
- props
AwsLog Driver Props
Returns
Creates a log driver configuration that sends log information to CloudWatch Logs.

.NET
Go
Java
Python
TypeScript (