[rabbitmq-discuss] Inconsistent log rotation
Matthias Radestock
matthias at rabbitmq.com
Wed Aug 10 07:05:34 BST 2011
Lionel,
On 10/08/11 06:58, Lionel Cons wrote:
> Alexandru Scvorcov writes:
> > 1. When RabbitMQ is started up, it will always start on a new file.
> > To prevent loss of information, we always append the current log file
> > to the end of a backup file (whose filename is constructed by
> > appending RABBITMQ_BACKUP_EXTENSION).
>
> RABBITMQ_BACKUP_EXTENSION defaults to ".1" so log information will be
> lost anyway after a subsequent restart.
As Alexandru said, we *append* the log file to the backup extension. So
if you bounce rabbit multiple times the .1 file will just keep growing.
No log information is lost.
> > 2. When a user manually rotates logs, that is, when a user manually
> > executes rabbitmqctl rotate_logs or via the init script, the server
> > appends it's current log to the backup log file (whose name is
> > constructed by appending ROTATE_SUFFIX) and starts using a
> > fresh log.
>
> AFAIK, ROTATE_SUFFIX defaults to "" so previous log information is
> lost (unless copied outside of the init script).
Right. That is intentional. The idea is that this allows you to work
with existing log rotation apps (e.g. logrotate) which will mv/rename
the main file and then simply invoke 'rabbitmqctl rotate_logs' to
re-open the current log file.
> IMHO, rabbitmq should not rotate logs on startup but rather, like most
> daemons, simply append.
That is what we do; the current log gets *appended* to the .1 file.
> The log rotation policy should be external to rabbitmq (logrotate is
> fine for this) and rabbitmq should cooperate by providing an easy to
> re-open the logs.
Likewise.
Regards,
Matthias.
More information about the rabbitmq-discuss
mailing list