-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ecs): log retention for FireLensLogDriver #28354
Conversation
…fix-firelens-publogpolicy
…fix-firelens-publogpolicy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍
I think that this should be a feat
: feat(ecs): support log retention for FireLensLogDriver
.
You could add some documentation about the newly supported option here.
@lpizzinidev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small documentation nit.
See the [Fluent Bit CloudWatch Configuration Parameters](https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch#configuration-parameters) | ||
for more information about `log_retention_days`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the [Fluent Bit CloudWatch Configuration Parameters](https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch#configuration-parameters) | |
for more information about `log_retention_days`. | |
> Visit [Fluent Bit CloudWatch Configuration Parameters](https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch#configuration-parameters) | |
for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This PR resolves the missing
logs:PutRetentionPolicy
permission issue when usingFireLensLogDriver
with CloudWatch Logs.Description
When using
FireLensLogDriver
to send logs to CloudWatch Logs, we can specify the retention period for newly created Log Groups by specifyinglog_retention_days
in theFireLensLogDriverProps.options
.https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch#configuration-parameters
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.FireLensLogDriverProps.html#options
If you have not added a FluentBit container, CDK will automatically add it to the task definition, and the IAM permissions required for this are added to the task role.
aws-cdk/packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts
Line 816 in db22b85
aws-cdk/packages/aws-cdk-lib/aws-ecs/lib/firelens-log-router.ts
Line 170 in db22b85
While
FireLensLogDriver
allows specifyinglog_retention_days
for Log Groups, FluentBit cannot set the retention period due to the absence of thelogs:PutRetentionPolicy
policy. Consequently, it results in anAccessDeniedException
.To address this, the PR adds the necessary
logs:PutRetentionPolicy
permission to the task role whenlog_retention_days
is set inFireLensLogDriverProps.options
, ensuring FluentBit has the required permissions to set the retention period for Log Groups.Relates to #28258
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license