@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.573Z") @Stability(value=Stable) 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 |
|---|---|
|
AwsLogDriver(AwsLogDriverProps props)
Constructs a new instance of the AwsLogDriver class.
|
protected |
AwsLogDriver(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
AwsLogDriver(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
LogDriverConfig |
bind(software.constructs.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.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected AwsLogDriver(software.amazon.jsii.JsiiObjectRef objRef)
protected AwsLogDriver(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public AwsLogDriver(@NotNull
AwsLogDriverProps props)
props - the awslogs log driver configuration options. This parameter is required.@Stability(value=Stable) @NotNull public LogDriverConfig bind(@NotNull software.constructs.Construct scope, @NotNull ContainerDefinition containerDefinition)
@Stability(value=Stable) @Nullable public ILogGroup getLogGroup()
Only available after the LogDriver has been bound to a ContainerDefinition.
@Stability(value=Stable)
public void setLogGroup(@Nullable
ILogGroup value)
Only available after the LogDriver has been bound to a ContainerDefinition.
Copyright © 2022. All rights reserved.