Description of problem: I have the following configured in /etc/logrotate.d/httpd: ---- /var/log/httpd/*log { compress monthly rotate 6 missingok sharedscripts postrotate /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true touch /var/log/httpd/APACHE_RESTART endscript } ---- The 'touch' is there for debugging purposes. The logrotate(8) manpage states: ---- The next section of the config files defined how to handle the log file /var/log/messages. The log will go through five weekly rotations before being removed. After the log file has been rotated (but before the old version of the log has been compressed), the command /sbin/killall -HUP syslogd will be executed. ---- However, after some testing, I found that logrotate does things in the following order: 1. Move the current access_log to access_log.1 2. Create a new empty access_log 3. gzip the access_log.1 into access_log.1.gz 4. run the postrotate scripts (HUP apache and touch the file) I would like the compression to occur after the apache server has been restarted (like the manpage suggests). Version-Release number of selected component (if applicable): logrotate-3.6.9-1 How reproducible: Always Steps to Reproduce: 1. setup a 'touch command' in the logrotate postrotate section 2. create a big logfile which takes some time to compress 3. run 'logrotate -f /etc/logrotate.conf' and see what happens. Actual Results: The files are being compressed before the postrotate commands are run. Expected Results: The postrotate commands should run before the files are compressed. Additional info:
Do not use sharedscripts directive.
Sharedscripts directive will cause that the files are being compressed before the postrotate. It's pity that it is not mentioned in man page. I'll try to fix it.
Hello. I found that this good wish. What do you think about implementing precomress/endscript so as to work with sharedscripts directive ?