[sheepdog-users] logrotate

Valerio Pachera sirio81 at gmail.com
Sat Oct 11 12:36:39 CEST 2014


A Yuan suggests, kill -HUP is going to rotate the log.

> lib/log.c, the handler for SIGHUP is
> rotate_log() /* line 557 */

I've been testing this and I have some notes and consideration:

1) it's enough to send the signal to one of the two sheep processes.
     Using killall is going to empty the rotated log.
2) rotate_log() uses a suffix when rotating logs, e.g.
sheep.log.2014-10-11-11-42
3) The function rotate_log() duplicates what the utility 'logrotate' does.

Both of the following basic configurations are working fine.
I don't understand why, the first doesn't create logs with the date
suffix as when sending manually kill -HUP.
Because of this, I feel more confident with the second.

/mnt/sheep/0/sheep.log {
        rotate 4
        notifempty
        postrotate
                /bin/kill -HUP $(pgrep sheep | head -1)
        endscript
}

/mnt/sheep/0/sheep.log {
        rotate 4
        truncate
        notifempty
}



More information about the sheepdog-users mailing list