Logrotate Supervisor

1 Januari 2022 • 1 menit untuk membaca artikel ini

supervisor example

cat /etc/supervisor/conf.d/myapi.conf
[program:myapi-scheduler]
command=docker exec -t my-api-1 node ace scheduler:run
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true
autostart=true
stdout_logfile_maxbytes=0
stdout_logfile_backups=0
stderr_logfile_maxbytes=0
stderr_logfile_backups=0
user=myapi
group=myapi

logrotate example

cat /etc/logrotate.d/supervisor-myapi 
/var/log/supervisor/*.log {
        daily
        missingok
        rotate 7
        compress
        delaycompress
        notifempty
        copytruncate
}

result example

ls /var/log/supervisor/

myapi-scheduler.log myapi-scheduler.log.2.gz myapi-scheduler.log.4.gz myapi-scheduler.log.6.gz supervisord.log supervisord.log.2.gz myapi-scheduler.log.1 myapi-scheduler.log.3.gz myapi-scheduler.log.5.gz myapi-scheduler.log.7.gz supervisord.log.1 supervisord.log.3.gz

Sumarsono

DevOps Engineer
Kembali ke atas

Dockerized Adonisjs>>

<<Kubernetes Adguardhome