@Generated(value="jsii-pacmak/1.70.0 (build 03c2f6f)", date="2022-11-01T13:16:47.284Z") @Stability(value=Experimental) 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
(experimental) A fluent builder for
AwsLogDriver. |
| Modifier | Constructor and Description |
|---|---|
|
AwsLogDriver(AwsLogDriverProps props)
(experimental) 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(Construct scope,
ContainerDefinition containerDefinition)
(experimental) Called when the log driver is configured on a container.
|
ILogGroup |
getLogGroup()
(experimental) The log group to send log streams to.
|
void |
setLogGroup(ILogGroup value)
(experimental) 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=Experimental)
public AwsLogDriver(@NotNull
AwsLogDriverProps props)
props - the awslogs log driver configuration options. This parameter is required.@Stability(value=Experimental) @NotNull public LogDriverConfig bind(@NotNull Construct scope, @NotNull ContainerDefinition containerDefinition)
@Stability(value=Experimental) @Nullable public ILogGroup getLogGroup()
Only available after the LogDriver has been bound to a ContainerDefinition.
@Stability(value=Experimental)
public void setLogGroup(@Nullable
ILogGroup value)
Only available after the LogDriver has been bound to a ContainerDefinition.
Copyright © 2022. All rights reserved.