You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Err(Error { kind: Unsupported, message: "creation time is not available on this platform currently" })let created = metadata.created().ok()?;
However, metadata.created() is not available on all platforms or filesystems. On my system (CentOS with [3.10.0-1160.119.1.el7.x86_64]), it always fails, which prevents max_log_files(2) from working as expected, leading to excessive log retention.
Expected behavior:
Old logs should be pruned correctly according to max_log_files(2), even if metadata.created() is unavailable.
Actual behavior:
Logs are not deleted because metadata.created() returns an error, causing prune_old_logs to fail early.
Suggested Fix
If metadata.created() fails, the function should fall back to metadata.modified(). If both are unavailable, extracting the timestamp from the filename (if applicable) could serve as an additional fallback. This would prevent log pruning from failing entirely due to missing creation timestamps.
Would you be open to a PR implementing this fallback logic? I can submit a PR if needed.
The text was updated successfully, but these errors were encountered:
Version
tracing-appender = "0.2.3"
Platform
CentOS Linux 7
Crates
tracing-appender
Description
In prune_old_logs, the function currently uses:
However, metadata.created() is not available on all platforms or filesystems. On my system (CentOS with [3.10.0-1160.119.1.el7.x86_64]), it always fails, which prevents max_log_files(2) from working as expected, leading to excessive log retention.
Expected behavior:
Old logs should be pruned correctly according to max_log_files(2), even if metadata.created() is unavailable.
Actual behavior:
Logs are not deleted because metadata.created() returns an error, causing prune_old_logs to fail early.
Suggested Fix
If metadata.created() fails, the function should fall back to metadata.modified(). If both are unavailable, extracting the timestamp from the filename (if applicable) could serve as an additional fallback. This would prevent log pruning from failing entirely due to missing creation timestamps.
Would you be open to a PR implementing this fallback logic? I can submit a PR if needed.
The text was updated successfully, but these errors were encountered: