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!
Force logrotate
Re: Force logrotate
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
}
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
}