Skip to content
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

Enhance ECS Container Insights by enabling host logs to be sent to CloudWatch #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jenademoodley
Copy link

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:

  • ECS agent logs
  • ECS audit logs
  • ECS init logs
  • ECS volume plugin logs
  • Docker daemon logs
  • Containerd logs
  • System log
  • Kernel log (i.e. dmesg)
  • /var/log/secure (Not collected on systems with rsyslog not installed such as AL2023. However these events are recorded in the system log)

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:

  1. Amazon Linux 2
  2. Amazon Linux 2023
  3. Ubuntu 20.04
  4. Ubuntu 22.04
  5. Ubuntu 24.04
  6. Red Hat Enterprise Linux (RHEL) 8
  7. Red Hat Enterprise Linux (RHEL) 9
  8. CentOS Stream 9

Requirements

Before committing the code, please verify the following:

  • If this commit includes changes to existing sample configurations, you acknowledge that you have confirmed this will not impact existing customer behavior.
  • If not necessary, consider creating a new sample configuration for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants