Force logrotate

General support questions including new installations
Post Reply
leaded
Posts: 29
Joined: 2005/09/30 19:44:19

Force logrotate

Post by leaded » 2009/01/28 17:45:06

If I run /usr/sbin/logrotate --force /etc/logrotate.d/httpd, it deletes the most recent file. For example, before...[code]
# ls /var/log/httpd/error*
error_log error_log.1 error_log.3 error_log.4[/code]
But after running the force rotate it became[code]
# ls /var/log/httpd/error*
error_log.2 error_log.3 error_log.4[/code]
And .2 did not contain the contents on error_log before I ran the command. How can I reliably make a forced logrotate? I would write a script myself but with all our our vhosts it would take a very long time.

Any advice would be much appreciated!

kentyler
Posts: 161
Joined: 2007/06/20 13:31:05
Location: Northeast Ohio
Contact:

Re: Force logrotate

Post by kentyler » 2009/01/30 18:14:58

Can you post the contents of your /etc/logrotate.d/httpd file and your /etc/logrotate.conf

Here is a working example that does not have the problem with force.


/var/log/httpd/*log {
missingok
rotate 1
compress
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}

Post Reply