Comment 3 for bug 1473405

Revision history for this message
Florek (sflorczak) wrote :

The issue can be reproducing in the following way:
in /var/log/rabbitmq there should be at least two files:
 - <email address hidden> with size less than 100MB (value configured in /etc/logrotate.conf), where X is the number of the node
 - any other file (*.log) with size more than 100MB
whenever logrotate will be run (/usr/sbin/logrotate -v /etc/logrotate.conf) it'll rotate the second file - because its larger than the defined threshold, will not rotate <email address hidden> because it's below threshold and after that the postscript will be run (according to /etc/logrotate.d/rabbitmq-server):
/etc/init.d/rabbitmq-server rotate-logs > /dev/null
Because the "ROTATE_SUFFIX" is not set in the /etc/init.d/rabbitmq-server no logs will be rotated, instead of that content of the /<email address hidden> will be flushed.

The simplest way to fix the issue is to change /etc/logrotate.d/rabbitmq-server in the following way:

delete:

 sharedscripts
        postrotate
            /etc/init.d/rabbitmq-server rotate-logs > /dev/null
        endscript

add:
 copytruncate

This way the "clearing script" will not be run. "copytruncate" will copy current log file to the new file and truncate the file currently used by the rabbitmq. Thanks to that the file handle used by rabbitmq doesn't have to be changed and the process itself doesn't have to be reloaded.