Supervisorのlogrotate

2022/03 の作業


NGINX の設定をコピって Supervisor の設定ファイルを作成する。

NGINX と同じで、アーカイブを1日毎にして、ファイル名に日付をつける事にする。

ローテ時のシグナルが違う。

/etc/supervisor/supervisord.conf の pidfile の中の pid にシグナルを送る。

$ sudo vi /etc/logrotate.d/supervisor
/var/log/supervisor/*log {  # <- 変更
    daily
    rotate 10
    missingok
    notifempty
    compress
    sharedscripts
    dateext                  
    dateformat _%Y-%m-%d_%H  
    postrotate
        /bin/kill -SIGUSR2 `cat /var/run/supervisord.pid 2>/dev/null` 2>/dev/null || true # <- 変更
    endscript
}