Skip to content

Log file rotation / size cap for long-session disk-fill prevention #2498

Description

@ten9876

Follow-up to #2478 (merge commit e8f27c73).

The new AsyncLogWriter writes to a single timestamped log file (e.g. aethersdr-20260509-144822.log) that grows unbounded until process exit. On long-running operator sessions — contests, beacon monitoring, multi-day SmartLink leases — the log can grow to tens or hundreds of MB depending on category filtering. No size cap, no rotation.

This is pre-existing behavior, not introduced by #2478, but #2478 makes log throughput cheaper and therefore makes this concern more relevant in practice (more verbose categories enabled by default → faster disk fill).

Symptoms when it bites

  • Disk space exhaustion on systems with small ~/.config partition or low free space
  • aethersdr.log symlink points to a multi-GB file after a week-long session
  • Support bundles become enormous and slow to upload
  • macOS file system warnings about low free space on Library partition

Suggested approaches

A. Size-based rotation (simplest)

  • New constant: kMaxLogFileSizeBytes = 50 * 1024 * 1024 (50 MB)
  • Writer thread tracks file size after each batch
  • When size exceeds limit: close current file, rename to .old, open new file with same name (or new timestamp), unlink any prior .old
  • One .old file kept as backup; oldest discarded on next rotation

B. Time-based rotation

  • New file every N hours (configurable, default 24h)
  • Easier to reason about for support purposes ("give me yesterday's log")
  • Filename naming continues the existing timestamp pattern

C. Hybrid (rotate on whichever happens first)

  • Bounded by both size and age
  • More complex but handles both "long quiet session" and "short verbose session" cleanly

D. AppSettings-controlled cap with cleanup-on-startup

  • Setting: MaxLogFileSizeMb (default 100)
  • Setting: LogRetentionDays (default 7)
  • Cleanup loop on startup deletes timestamped logs older than retention or when total size exceeds cap
  • No mid-session rotation; just bounded historical footprint

Considerations

  • The aethersdr.log symlink (used by Support dialog) needs to follow rotation so support bundles capture the active file
  • Active log file must be re-opened on rotation; AsyncLogWriter's writer thread is the only thread allowed to touch the file handle
  • Rotation should never lose log lines — drain the buffer to the old file before swapping

Priority

Low. Disk-fill is a long-tail symptom; most operators don't keep AetherSDR running for days continuously. Worth doing as cleanup-on-startup at minimum (option D), as an opt-in setting, before any user actually hits a disk-full crash.

73, Jeremy KK7GWY & Claude (AI dev partner)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing featuremaintainer-reviewRequires maintainer review before any action is takenpriority: lowLow priority

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions