Skip to content

chore: prune old compressed log archives in ~/.local/state #94

@smartwatermelon

Description

@smartwatermelon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions