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.
Incorrect. nocompress disables compression.
compress / nodelaycompressIncorrect. nodelaycompress compresses the newest rotated file immediately.
Incorrect. nodelaycompress compresses the newest rotated file immediately.
compress / delaycompressCorrect. It compresses older generations while delaying the newest one.
Correct. It compresses older generations while delaying the newest one.
delaycompress / rotate 0Incorrect. rotate 0 retains no old generations.
Incorrect. 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
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.