Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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 hystorical reason can be somehow found in 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.
share|improve this answer

Yes, this is done so that more recent log files are easier to access. The logrotate option delaycompress controls this. From the logrotate manpage:

delaycompress

Postpone compression of the previous log file to the next rotation cycle.  
This only has effect when used in combination with
compress.  It can be  used  when  some  program
cannot be told to close its logfile and thus might 
continue writing to the previous log file for some time.
share|improve this answer
1  
These options are used in the files under /etc/logrotate.conf and /etc/logrotate.d/*. –  slm Aug 7 '13 at 15:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.