Recently I was wondering what was causing the beachballs when trying to export logs on macOS. Here's the analysis.
TLDR: there is no log rotation and the nym-vpnd.log in /private/var/log/nym-vpnd/ grows unbounded.
Title: Log file grows without bound — replace startup rename with proper rolling rotation
Repo: nym-vpn-client
Component: nym-vpn-core/crates/nym-vpn-lib/src/logging.rs
Type: Enhancement / Bug
Description:
nym-vpnd.log has no rolling rotation policy. The current implementation in logging.rs performs a single rename on daemon startup (nym-vpnd.log → nym-vpnd.old.log), giving at most two files that grow without bound between restarts. After approximately one week of continuous uptime, the log file reaches 287MB and 1.4 million lines. This directly causes a 30–60 second beach ball when the user opens the log viewer in the macOS app.
Current behaviour (FileAppender::new):
// On startup: rename current → .old, then append forever
std::fs::rename(&log_file_path, &old_log_file_path);
tracing_appender::rolling::never(log_dir.clone(), log_file_name)
Expected behaviour:
Size- or time-based rolling rotation, keeping a small number of compressed archives, so that total on-disk log footprint is bounded regardless of uptime.
Suggested fix:
tracing_appender::RollingFileAppender is already imported but unused for rolling. Replace rolling::never() with a size- or daily-based appender, for example:
tracing_appender::rolling::daily(log_dir, log_file_name)
// or size-based with a third-party rolling appender crate
Retain the last 3–5 rotated files and gzip-compress them. A reasonable target is a maximum of ~50MB total log footprint.
Contributing factor:
Log verbosity is a significant multiplier. nym_dns::imp emits 4 near-identical "Saving DNS settings []" lines approximately every 600ms for empty NetBird DNS entries, which alone accounts for a large share of the file size and should be addressed separately.
Environment:
- macOS 14.8.5 Sonoma (x86_64)
nym-vpn-lib 1.29.1
- Log observed: 287MB, ~1.4M lines, ~7 days uptime, single continuous session
Recently I was wondering what was causing the beachballs when trying to export logs on macOS. Here's the analysis.
TLDR: there is no log rotation and the nym-vpnd.log in /private/var/log/nym-vpnd/ grows unbounded.
Title: Log file grows without bound — replace startup rename with proper rolling rotation
Repo:
nym-vpn-clientComponent:
nym-vpn-core/crates/nym-vpn-lib/src/logging.rsType: Enhancement / Bug
Description:
nym-vpnd.loghas no rolling rotation policy. The current implementation inlogging.rsperforms a single rename on daemon startup (nym-vpnd.log→nym-vpnd.old.log), giving at most two files that grow without bound between restarts. After approximately one week of continuous uptime, the log file reaches 287MB and 1.4 million lines. This directly causes a 30–60 second beach ball when the user opens the log viewer in the macOS app.Current behaviour (
FileAppender::new):Expected behaviour:
Size- or time-based rolling rotation, keeping a small number of compressed archives, so that total on-disk log footprint is bounded regardless of uptime.
Suggested fix:
tracing_appender::RollingFileAppenderis already imported but unused for rolling. Replacerolling::never()with a size- or daily-based appender, for example:Retain the last 3–5 rotated files and gzip-compress them. A reasonable target is a maximum of ~50MB total log footprint.
Contributing factor:
Log verbosity is a significant multiplier.
nym_dns::impemits 4 near-identical "Saving DNS settings []" lines approximately every 600ms for empty NetBird DNS entries, which alone accounts for a large share of the file size and should be addressed separately.Environment:
nym-vpn-lib1.29.1