Enhance ECS Container Insights by enabling host logs to be sent to CloudWatch #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue
In a container environment, it is important to monitor the host for any host-level issues and/or impacting behaviour. While Container Insights allows the collection of host-level metrics using the CloudWatch agent in daemon mode, logs from the host such as Docker daemon and ECS agent logs. However, instances may sometimes be terminated, or not be configured to allow access, hence it would be impossible in these cases to access the logs and triage the issue. There is a need for an automated log collection for ECS Container Insights.
Description of changes
This pull request introduces the capability to deploy fluent-bit as an additional daemonset to collect the logs from the host and populate them in CloudWatch in the
/aws/ecs/containerinsights/${CLUSTER_NAME}/instance-logs
log group. The below logs are collected:License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
This PR does not modify the existing CloudWatch agent CFN stack and configurations, hence existing users using these stacks would experience no changes. Fluent-bit is provided as an additional configuration and CFN stack (for existing Container Insights users wanting to upgrade, or for those who simply want to deploy only one option), and there is a third stack which can deploy both CloudWatch agent and Fluent-Bit in a single stack (for new users).
The solution is confirmed to work on the below Operating Systems:
Requirements
Before committing the code, please verify the following: