Feature Request: Automatically compress rotated log files exceeding size limit into tar.gz with date + logname + sequence number naming
Closed this issue · 1 comments
Currently, spdlog supports log file rotation based on size or time, but it does not have built-in functionality to automatically compress old rotated log files.
I would like to propose a new feature:
When a log file exceeds a specified size limit and rotation is triggered, the rotated log file is automatically compressed into a tar.gz archive.
The compressed file should be named using the format like .tar.gz, for example, 2025-08-07_mylog_1.tar.gz.
Users can optionally specify a custom directory for storing compressed files (default to the log file’s directory).
This feature can be an optional switch for the rotation policy and disabled by default.
Expected Benefits
Reduce disk space usage and facilitate long-term log storage.
Maintain clear and consistent naming conventions for rotated and compressed logs.
Enhance spdlog’s log management capabilities.
References
Similar features exist in other logging libraries like log4cplus and log4j, and many users have expressed interest in this functionality.
If the maintainers find this feature useful, I’m happy to contribute an implementation.
Which lib would it use for compression? And how would it be installed?