Problem
Compressed log archives (.log-*.gz files from logrotate) accumulate indefinitely in /Users/operator/.local/state/. Files going back to January 2025 are still present.
While logrotate's rotate 30 setting limits the number of rotated files per log pattern, the archives are never cleaned up beyond that — and with multiple log sources, the directory grows over time.
Scope
Add automated pruning of old .gz archives in ~/.local/state/. Options:
- Add a
postrotate script in config/logrotate.conf that deletes .gz files older than N days
- Create a separate cleanup LaunchAgent/timer
- Extend the existing logrotate
postrotate block (which already cleans up /tmp files)
Considerations
- Decide on retention policy (30 days? 90 days?)
- The
postrotate block in config/logrotate.conf already runs find /tmp -name "*.log" -mtime +7 -delete — extending it with a similar rule for ~/.local/state/*.gz would be the simplest approach
- Should also consider whether the
delaycompress + rotate 30 + daily settings are producing more archives than intended
Problem
Compressed log archives (
.log-*.gzfiles from logrotate) accumulate indefinitely in/Users/operator/.local/state/. Files going back to January 2025 are still present.While logrotate's
rotate 30setting limits the number of rotated files per log pattern, the archives are never cleaned up beyond that — and with multiple log sources, the directory grows over time.Scope
Add automated pruning of old
.gzarchives in~/.local/state/. Options:postrotatescript inconfig/logrotate.confthat deletes.gzfiles older than N dayspostrotateblock (which already cleans up/tmpfiles)Considerations
postrotateblock inconfig/logrotate.confalready runsfind /tmp -name "*.log" -mtime +7 -delete— extending it with a similar rule for~/.local/state/*.gzwould be the simplest approachdelaycompress+rotate 30+dailysettings are producing more archives than intended