Automatically refer to the appropriate, regional FireLens image with addFirelensLogRouter()
See original GitHub issueThe documentation suggests using Amazon’s own ECR images for the FireLens container. However, image
is a required property.
It would be a nice convenience if CDK could determine the destination stack’s region and automatically use the proper ecr.Repository.fromRepositoryArn()
behavior.
Use Case
Today, I can get this behavior manually, but I had to generate the reference myself:
// Amazon recommends pulling this image from their regional ECR repo
// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-using-fluentbit
const awsEcrRepo = ecr.Repository.fromRepositoryArn(
parent,
"AWSFireLensRepo",
"arn:aws:ecr:us-west-2:906394416424:repository/aws-for-fluent-bit",
);
taskDefinition.addFirelensLogRouter("DatadogFirelensLogRouter", {
image: ecs.ContainerImage.fromEcrRepository(awsEcrRepo, "latest"),
memoryReservationMiB: 50,
essential: true,
firelensConfig: {
type: ecs.FirelensLogRouterType.FLUENTBIT,
options: {
enableECSLogMetadata: true,
configFileType: ecs.FirelensConfigFileType.FILE,
configFileValue: "/fluent-bit/configs/parse-json.conf",
},
},
});
Proposed Solution
Ideally, image
on FirelensLogRouterDefinitionOptions
is an optional parameter and defaults to the proper ECR image from this table in the docs.
Other
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (4 by maintainers)
Top Results From Across the Web
class FirelensLogRouter (construct) · AWS CDK
The working directory in which to run commands inside the container. firelensConfig. Type: FirelensConfig. Firelens configuration. image. Type: ...
Read more >Creating a task definition that uses a FireLens configuration
To use custom log routing with FireLens , you must specify the following in your ... described in Amazon Web Services documentation might...
Read more >AWS FireLens plugin for log forwarding
New Relic uses a Fluent Bit image to configure the FireLens log router container. This container handles all log routing from application plugins....
Read more >aws_ecs_task_definition | Resources | hashicorp/aws
resource "aws_ecs_task_definition" "service" { family = "service" container_definitions = jsonencode([ { name = "first" image = "service-first" cpu = 10 ...
Read more >Lab 2: Deploy Cluster - ECS_Fargate_Workshop
Using roughly 15 lines of Python code you can instantiate ECS Task (note task_image options describing image details, port mappings, logging setting and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The package @aws-cdk/aws-ecs exports the function
obtainDefaultFluentBitECRImage
. This will reference the appropriate regional image for fluent bit.You can view usage here: https://stackoverflow.com/questions/64299664/how-to-configure-aws-cdk-applicationloadbalancedfargateservice-to-log-parsed-jso/
I will say that it takes a lot of discovery to figure out how to override the default logDriver to enable json line parsing. Definitely either more documentation or a simpler API would be helpful.
Q: I can’t find any docs for
obtainDefaultFluentBitECRImage
.So I think the AWS ECS FireLens constructs are supposed to live here now: https://github.com/cdklabs/cdk-ecs-service-extensions/
But then the function still seems to only be here:
obtainDefaultFluentBitECRImage
in this repo.Are there no docs for this function? Or do I not know the right place to look? Is it not intended for end-user direct use?
https://github.com/cdklabs/cdk-ecs-service-extensions/issues/249
@SomayaB @uttarasridhar