Below is my log rotation configuration for /var/log/messages.
/var/log/messages
{
rotate 4
size 100M
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
ifconfig eth0 | grep 'Device not found' &>/dev/null
if [ $? != 0 ]; then
kill -HUP $(cat /var/run/rsyslog.pid) > /dev/null
else
kill -HUP $(cat /var/run/rsyslog_1.pid) > /dev/null
fi
endscript
}
I ended up in a scenario where logrotate created messages.1 where my previous logs are copied and rsyslog is still writing into messages.1 (might be because of delaycompress). Now messages file is created newly when log rotation happened it is of size Zero.
Since I have huge logging enabled for my application and rsyslog is still writing into messages.1, it became more than 3G while messages file being zero.
Any wrong with my configurations or do i need to enable/disable certain logrotate features to never end up in this kind of scenario ?
# logrotate --version
logrotate 3.8.7