FireLensLogDriverProps Struct
Specifies the firelens log driver configuration options.
| Source | aws-ecs/lib/log-drivers/firelens-log-driver.ts |
|---|
Example
ts
// 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.firelens({
options: {
Name: 'firehose',
region: 'us-west-2',
delivery_stream: 'my-stream',
},
}),
});
python
# Create a Task Definition for the container to start
task_definition = ecs.Ec2TaskDefinition(self, "TaskDef")
task_definition.add_container("TheContainer",
image=ecs.ContainerImage.from_registry("example-image"),
memory_limit_mi_b=256,
logging=ecs.LogDrivers.firelens(
options={
"Name": "firehose",
"region": "us-west-2",
"delivery_stream": "my-stream"
}
)
)
java
// Create a Task Definition for the container to start
Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.addContainer("TheContainer", ContainerDefinitionOptions.builder()
.image(ContainerImage.fromRegistry("example-image"))
.memoryLimitMiB(256)
.logging(LogDrivers.firelens(FireLensLogDriverProps.builder()
.options(Map.of(
"Name", "firehose",
"region", "us-west-2",
"delivery_stream", "my-stream"))
.build()))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Create a Task Definition for the container to start
var taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.AddContainer("TheContainer", new ContainerDefinitionOptions {
Image = ContainerImage.FromRegistry("example-image"),
MemoryLimitMiB = 256,
Logging = LogDrivers.Firelens(new FireLensLogDriverProps {
Options = new Dictionary<string, string> {
{ "Name", "firehose" },
{ "region", "us-west-2" },
{ "delivery_stream", "my-stream" }
}
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create a Task Definition for the container to start
taskDefinition := ecs.NewEc2TaskDefinition(this, jsii.String("TaskDef"))
taskDefinition.AddContainer(jsii.String("TheContainer"), &ContainerDefinitionOptions{
Image: ecs.ContainerImage_FromRegistry(jsii.String("example-image")),
MemoryLimitMiB: jsii.Number(256),
Logging: ecs.LogDrivers_Firelens(&FireLensLogDriverProps{
Options: map[string]*string{
"Name": jsii.String("firehose"),
"region": jsii.String("us-west-2"),
"delivery_stream": jsii.String("my-stream"),
},
}),
})
Properties
envoptionalstring[]envoptionaltyping.List[str]envoptionalList<String>Envoptionalstring[]Envoptional*[]*string #The env option takes an array of keys.
Default: No env
If there is collision between label and env keys, the value of the env takes precedence. Adds additional fields to the extra attributes of a logging message.
envRegexoptionalstringenv_regexoptionalstrenvRegexoptionalStringEnvRegexoptionalstringEnvRegexoptional*string #The env-regex option is similar to and compatible with env.
Default: No envRegex
Its value is a regular expression to match logging-related environment variables. It is used for advanced log tag options.
labelsoptionalstring[]labelsoptionaltyping.List[str]labelsoptionalList<String>Labelsoptionalstring[]Labelsoptional*[]*string #The labels option takes an array of keys.
Default: No labels
If there is collision between label and env keys, the value of the env takes precedence. Adds additional fields to the extra attributes of a logging message.
optionsoptional{ [key: string]: string }optionsoptionaltyping.Mapping[str, str]optionsoptionalMap<String, String>OptionsoptionalIDictionary<string, string>Optionsoptional*map[string]*string #The configuration options to send to the log driver.
Default: the log driver options
secretOptionsoptional{ [key: string]: Secret }secret_optionsoptionaltyping.Mapping[str, Secret]secretOptionsoptionalMap<String, Secret>SecretOptionsoptionalIDictionary<string, Secret>SecretOptionsoptional*map[string]Secret #The secrets to pass to the log configuration.
Default: No secret options provided.
By default, Docker uses the first 12 characters of the container ID to tag log messages.
Default: The first 12 characters of the container ID
Refer to the log tag option documentation for customizing the log tag format.