Skip to content
v2.275.0

LogDriver Class ​

The base class for log drivers.

Example ​

ts
declare const secret: ecs.Secret;

// 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.splunk({
    secretToken: secret,
    url: 'my-splunk-url',
  }),
});

Initializer ​

ts
new LogDriver()
python
LogDriver()
java
new LogDriver()
csharp
new LogDriver()
go
NewLogDriver()

Methods ​

awsLogs(props: AwsLogDriverProps): LogDriver // chainable@staticmethod def aws_logs(props: AwsLogDriverProps) -> LogDriverpublic static LogDriver awsLogs(AwsLogDriverProps props)public static LogDriver AwsLogs(AwsLogDriverProps props)func AwsLogs(Props AwsLogDriverProps) LogDriverstatic#
Creates a log driver configuration that sends log information to CloudWatch Logs.
bind(scope: Construct, containerDefinition: ContainerDefinition): LogDriverConfigdef bind(self, scope: Construct, container_definition: ContainerDefinition) -> LogDriverConfigpublic LogDriverConfig bind(Construct scope, ContainerDefinition containerDefinition)public LogDriverConfig Bind(Construct scope, ContainerDefinition containerDefinition)func Bind(Scope Construct, ContainerDefinition ContainerDefinition) LogDriverConfig#
Called when the log driver is configured on a container.