With logrotate 3.21.0.61_cb99
The following configuration:
/var/log/foo.log
{
copytruncate
compress
}
Fails with
error: unable to open /var/log/foo.log.1 (read-only) for compression: No such file or directory
This is because rotateSingleLog calls copyTruncate with rotateCount=0 hence:
skip copying /var/log/foo.log to /var/log/foo.log.1
And in postrotateSingleLog we call compressLogFile which gives the earlier error.
Calling logrotate in debug does not check this (early return in compressLogFile).
I guess one could check that when giving copyTruncate and compress , rotate needs to be above 0.
Note that without compress, /var/log/foo.log is just truncated.