Skip to content

Conversation

@akuzminsky
Copy link
Member

Summary

  • Remove binary log files (btmp/wtmp) that CloudWatch agent cannot parse
  • Fix agent startup to properly resolve supplementary groups via systemd
  • Remove duplicate DiskSpaceUsed metric

Details

Binary log files removed

btmp and wtmp are binary files in utmp format that CloudWatch agent cannot parse as text logs, resulting in garbled data in log streams. Authentication data is already captured in auth.log in a parseable format, so these files are redundant.

Agent startup fix

Removed the -s flag from amazon-cloudwatch-agent-ctl command and added notify => Service[...] to ensure the agent starts via systemd. This fixes an issue where the agent process would start without supplementary groups (like adm) because the -s flag bypasses systemd's group resolution.

Cleanup

  • Removed utmp group from cwagent user (no longer needed without btmp/wtmp)
  • Removed duplicate DiskSpaceUsed metric from sandbox environment

Test plan

  • Verify CloudWatch agent starts with correct groups: cat /proc/$(pgrep -f amazon-cloudwatch)/status | grep Groups
  • Confirm auth.log is being collected in CloudWatch Logs
  • Verify no permission denied errors in agent logs

btmp and wtmp are binary files in utmp format that CloudWatch agent
cannot parse as text logs, resulting in garbled data in the log streams.
Authentication data is already captured in auth.log in a parseable format.

Changes:
- Remove btmp/wtmp entries from CloudWatch agent templates
- Remove utmp group from cwagent user (no longer needed)
- Remove duplicate DiskSpaceUsed metric
- Fix agent startup: remove -s flag from amazon-cloudwatch-agent-ctl and
  add notify to Service resource for proper systemd group resolution
- Update logrotate postrotate comment for clarity

Applied to modules/profile and propagated to sandbox and development
environments.
@akuzminsky akuzminsky merged commit 8f0e252 into main Dec 23, 2025
2 checks passed
@akuzminsky akuzminsky deleted the common-pattern branch December 23, 2025 13:51
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