2014-04-28 9 views
5

나는 supervisord로 몇 가지 PHP 프로세스를 시작했으며 모든 stdout 로그를 하나의 파일에 보관하고 다른 하나는 오류 출력을 유지하고있다. 최대 크기를 1MB로 설정했고 각 프로세스마다 3 개의 복사본을 실행 중입니다. 로그를 검사 할 때 로그 파일 중 하나 이상이 표시되므로 "log1.log"대신 "log1.log log1.log.1 log1.log.2 log1.log.3"이 표시됩니다. 프로세스가 제대로 작동하는 것 같습니다 그래서 그냥 명확하게 요청하는 것입니다, 로그가 다른 프로세스에서 쓰기 위해 잠겨 있기 때문에 이런 일이 발생하므로 쓰려고하는 프로세스가 다른 파일을 사용해야합니다?슈퍼 바이저 로그 파일 순환 설정

[program:Sitbot1_1_1] 
command=/usr/local/bin/php -f process.php 1 1 1 2   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_2] 
command=/usr/local/bin/php -f process.php 1 2 3 4   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_3] 
command=/usr/local/bin/php -f process.php 1 3 5 6   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_4] 
command=/usr/local/bin/php -f process.php 1 4 7 9   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_5] 
command=/usr/local/bin/php -f process.php 1 5 10 12   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_6] 
command=/usr/local/bin/php -f process.php 1 6 13 15   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_7] 
command=/usr/local/bin/php -f process.php 1 7 16 18   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_8] 
command=/usr/local/bin/php -f process.php 1 8 19 22   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 





[program:Sitbot1_1_9] 
command=/usr/local/bin/php -f process.php 1 9 23 26   ; the program (relative uses PATH, can take args) 
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) 
numprocs=3     ; number of processes copies to start (def 1) 
directory=/home/userkdo/domains/domain/public_html/bot1    ; directory to cwd to before exec (def no cwd) 
;umask=022      ; umask for process (default None) 
;priority=999     ; the relative start priority (default 999) 
autostart=false    ; start at supervisord start (default: true) 
autorestart=true  ; whether/when to restart (default: unexpected) 
;startsecs=1     ; number of secs prog must stay running (def. 1) 
;startretries=3    ; max # of serial start failures (default 3) 
;exitcodes=0,2     ; 'expected' exit codes for process (default 0,2) 
;stopsignal=TERM    ; signal used to kill process (default TERM) 
;stopwaitsecs=10    ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=true    ; send stop signal to the UNIX process group (default false) 
;killasgroup=true    ; SIGKILL the UNIX process group (def false) 
user=userkdo     ; setuid to this UNIX account to run the program 
;redirect_stderr=true   ; redirect proc stderr to stdout (default false) 
stdout_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.log  ; stdout log path, NONE for none; default AUTO 
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10  ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
stderr_logfile=/home/userkdo/domains/domain/public_html/bot1/log/log1.err  ; stderr log path, NONE for none; default AUTO 
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10  ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2"  ; process environment additions (def no adds) 
;serverurl=AUTO    ; override serverurl computation (childutils) 

답변

9

이 효과는 log rotation이라고합니다. 로그 파일이 stdout_logfile_maxbytes의 값보다 크면 백업 내용이 logfile.log.1로 이동됩니다. 당신은 당신이 할 수있는이 동작을 변경하려면 : stdout_logfile_maxbytes 0의

  • 값 변경 - 모든 로그는 하나 개의 로그 파일에 저장됩니다.
  • stdout_logfile_backups 값을 0으로 변경 - 로그 파일이 너무 클 경우 오래된 로그가 별도의 파일로 이동하는 대신 삭제됩니다.

stderr_logfile_maxbytesstderr_logfile_backups에 따라 동일하게 적용됩니다.

+0

어쨌든 thnx가 어떻게 생겼는지 들립니다. – Evan

+0

@daniula이 값을 설정하지 않으면 기본 stdout_logfile_maxbytes가 있습니까 ?? – tyan

+0

@tyan [documentation] (http://supervisord.org/configuration.html#program-x-section-values)에 따르면'stdout_logfile_maxbytes'의 기본값은 50MB입니다. – daniula