Compress rotated logs with gzip but leave the immediately rotated generation uncompressed until the next rotation.
Which directive combination is appropriate?
compress enables compression and delaycompress postpones compression of the most recently rotated file by one cycle.
Detailed explanation
nocompress / delaycompressIncorrect. nocompress disables compression.
compress / nodelaycompressIncorrect. nodelaycompress compresses the newest rotated file immediately.
compress / delaycompressCorrect. It compresses older generations while delaying the newest one.
delaycompress / rotate 0Incorrect. rotate 0 retains no old generations.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' compress delaycompressExpected result
compressとdelaycompressKey points
- compress enables compression
- delaycompress delays one generation
- Useful for programs holding files open
Notes
- Environment: printf / ログ変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Syslog facility and priority
Metadata that classifies a message source and its severity.
Journal persistence
Whether systemd journal data survives a reboot and where it is stored.
Log rotation
A process that retains, renames, compresses, or removes log generations.