- Newest
- Most votes
- Most comments
To ensure system logs are consistently collected and sent to CloudWatch from all Amazon EKS Managed Nodes running Amazon Linux 2023, including new nodes from autoscaling, you need to make several adjustments to your current setup.
First, your approach of using Fluent Bit as a DaemonSet is correct, as this ensures the log collector runs on all nodes, including any new ones added through autoscaling. However, your configuration needs some adjustments to work properly with Amazon Linux 2023, which uses systemd-journald for log management by default.
Here are the recommended steps:
- Update your Fluent Bit configuration: Your current systemd input configuration is close, but may need refinement. Ensure you have specific Systemd_Filter options to target the services you want to monitor:
[INPUT]
Name systemd
Tag host.*
Systemd_Filter _SYSTEMD_UNIT=kubelet.service
Systemd_Filter _SYSTEMD_UNIT=docker.service
Read_From_Tail On
-
Use launch templates with your managed node group: Create a launch template that includes user data scripts to ensure proper CloudWatch agent configuration. This approach ensures that any new node created through autoscaling will have the correct configuration automatically.
-
Ensure proper IAM permissions: Make sure the IAM role attached to your EKS nodes includes the
CloudWatchAgentServerPolicyandAmazonSSMManagedInstanceCoreAWS managed policies to allow proper log forwarding. -
Verify volume mounts: Your volume mounts look correct for accessing the systemd journal, but ensure that all paths exist on the Amazon Linux 2023 instances.
-
Consider enabling Container Insights: This AWS solution automatically collects metrics and logs from your EKS cluster and can simplify your logging setup.
-
Implement log rotation: Set up log rotation to manage log file sizes and prevent disk space issues.
-
Monitor log ingestion: Set up alerts for log ingestion failures to ensure your logging pipeline is working correctly.
If you're still experiencing issues with logs not reaching CloudWatch, check the Fluent Bit pods' logs for any errors or configuration issues. Also verify that your CloudWatch output plugin is correctly configured with the proper region and log group settings.
By implementing these recommendations, you should be able to ensure consistent system log collection across all your EKS nodes, including those added through autoscaling.
Sources
How to collect system logs in EKS Managed Node Group (Amazon Linux 2023) using Fluent Bit? | AWS re:Post
Logging for Amazon EKS - AWS Prescriptive Guidance
Types of logging in Amazon EKS - AWS Prescriptive Guidance
Best practices for logging in Amazon EKS - AWS Prescriptive Guidance
Set up Fluent Bit as a DaemonSet to send logs to CloudWatch Logs - Amazon CloudWatch
answered a year ago
Relevant content
asked a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
