==================
== DRAGONSLAYER ==
==================

Make supervisord logging feature work with logrotate

supervisord won’t append new logs to the new log file created by logrotate after the rotation, this is because the file descriptor (fd) does not change within the running supervisord process. To make supervisor close current log file (both for child process log files and the supervisord itself) and reopen, send a SIGUSR2 to supervisord. For detail, see documentation.

/var/log/some_application/*.log {
        daily
        dateext
        dateformat .%Y-%m-%d
        dateyesterday
        missingok
        rotate 32767
        compress
        delaycompress
        notifempty
        create 0644 root root
        sharedscripts
        postrotate
                [ -s /var/run/some-app-supervisord.pid ] && kill -USR2 `cat /var/run/some-app-supervisord.pid`
        endscript
}

A postrotate block in logrotate config should solve the problem. [ -s filename ] means to test whether there were a file named with “filename” and its size is greater than zero.