Why the second log files on /var/log are not compressed

logs

the logs on /var/log/ (Debian/Ubuntu) are stored as

x.log
x.log.1
x.log.2.gz
...

like kernel logs, syslogs, etc.

I see that as the log info increases, they are stored by splitting into smaller files (rather than keeping all in a single file). I wonder why the second file (x.log.1) is not compressed? Is it something to do with accessing more recent logs easier?

Best Answer

I agree with you, that should only provide an easier access to recent files. Anyway, the actual behaviour is decided via logrotate delaycompress directive, which says:

do not compress the file as you rotate, but compress it next time

The historical reason can be found in the logrotate manual:

Postpone  compression of the previous log file to the next rotation 
cycle.  This has only effect when used in combination  with compress. 
It can be used when some program can not be told to close its logfile and 
thus might continue writing to the  previous log file for some time.
Related Question