Skip to content

Log files accumulate rapidly and consume excessive disk space #1154

@og900aero

Description

@og900aero

Description

Fresh creates a new log file for every session (per PID), but never cleans up old ones. This causes the ~/.local/state/fresh/logs/ directory to grow very quickly — in my case, over 1 GB of logs accumulated within just 2 days.

Steps to Reproduce

  1. Use Fresh normally for a few days
  2. Check ~/.local/state/fresh/logs/
  3. Observe hundreds of log files (e.g. fresh-<PID>.log, status-<PID>.log, warnings-<PID>.log) totaling several hundred MB to GB

Example

$ du -sh ~/.local/state/fresh/
1.1G    /home/user/.local/state/fresh/logs/

$ ls ~/.local/state/fresh/logs/ | wc -l
503

$ ls -lhS ~/.local/state/fresh/logs/ | head -5
.rw-rw-r--  35M  fresh-3767.log
.rw-rw-r--  30M  fresh-5271.log
.rw-rw-r--  22M  fresh-3691.log
.rw-rw-r--  14M  fresh-3556.log
.rw-rw-r--  12M  fresh-4947.log

Expected Behavior

Log files should either:

  • be limited in total size / number of files (log rotation), or
  • respect a log_level config option so users can reduce verbosity

Suggested Fix / Feature Request

Please consider adding one or more of the following:

  1. Log retention setting in config.json, e.g.:
    {
      "log_retention_days": 7
    }
  2. Log rotation — keep only the last N sessions or cap total log directory size
  3. Log level config — allow users to set log_level: "warn" or "error" to reduce output size significantly
  4. Cleanup on startup — automatically delete logs older than X days when Fresh launches

Environment

  • OS: Linux
  • Fresh version: fresh 0.2.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions