Class AwsLogDriver
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ecs.LogDriver
software.amazon.awscdk.services.ecs.AwsLogDriver
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:47.009Z")
@Stability(Stable)
public class AwsLogDriver
extends LogDriver
A log driver that sends log information to CloudWatch Logs.
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());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
ModifierConstructorDescriptionAwsLogDriver
(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) -
Method Summary
Modifier and TypeMethodDescriptionbind
(Construct scope, ContainerDefinition containerDefinition) Called when the log driver is configured on a container.The log group to send log streams to.void
setLogGroup
(ILogGroup value) The log group to send log streams to.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
AwsLogDriver
protected AwsLogDriver(software.amazon.jsii.JsiiObjectRef objRef) -
AwsLogDriver
protected AwsLogDriver(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
AwsLogDriver
Constructs a new instance of the AwsLogDriver class.- Parameters:
props
- the awslogs log driver configuration options. This parameter is required.
-
-
Method Details
-
bind
@Stability(Stable) @NotNull public LogDriverConfig bind(@NotNull Construct scope, @NotNull ContainerDefinition containerDefinition) Called when the log driver is configured on a container. -
getLogGroup
The log group to send log streams to.Only available after the LogDriver has been bound to a ContainerDefinition.
-
setLogGroup
The log group to send log streams to.Only available after the LogDriver has been bound to a ContainerDefinition.
-