@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:49.406Z") public class AwsLogDriver extends LogDriver
Example:
Cluster cluster; // Create a Task Definition for the container to start Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef"); taskDefinition.addContainer("TheContainer", ContainerDefinitionOptions.builder() .image(ContainerImage.fromAsset(resolve(__dirname, "..", "eventhandler-image"))) .memoryLimitMiB(256) .logging(AwsLogDriver.Builder.create().streamPrefix("EventDemo").mode(AwsLogDriverMode.NON_BLOCKING).build()) .build()); // An Rule that describes the event trigger (in this case a scheduled run) Rule rule = Rule.Builder.create(this, "Rule") .schedule(Schedule.expression("rate(1 min)")) .build(); // Pass an environment variable to the container 'TheContainer' in the task rule.addTarget(EcsTask.Builder.create() .cluster(cluster) .taskDefinition(taskDefinition) .taskCount(1) .containerOverrides(List.of(ContainerOverride.builder() .containerName("TheContainer") .environment(List.of(TaskEnvironmentVariable.builder() .name("I_WAS_TRIGGERED") .value("From CloudWatch Events") .build())) .build())) .build());
Modifier and Type | Class and Description |
---|---|
static class |
AwsLogDriver.Builder
A fluent builder for
AwsLogDriver . |
Modifier | Constructor and Description |
---|---|
protected |
AwsLogDriver(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
AwsLogDriver(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
LogDriverConfig |
bind(Construct scope,
ContainerDefinition containerDefinition)
Called when the log driver is configured on a container.
|
ILogGroup |
getLogGroup()
The log group to send log streams to.
|
void |
setLogGroup(ILogGroup value)
The log group to send log streams to.
|
protected AwsLogDriver(software.amazon.jsii.JsiiObjectRef objRef)
protected AwsLogDriver(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public LogDriverConfig bind(Construct scope, ContainerDefinition containerDefinition)
public ILogGroup getLogGroup()
Only available after the LogDriver has been bound to a ContainerDefinition.
public void setLogGroup(ILogGroup value)
Only available after the LogDriver has been bound to a ContainerDefinition.