/
WebTatic 에서 Nginx 패키지 설치후 log rotate 후 log 파일이 0 이 되는 문제 해결
WebTatic 에서 Nginx 패키지 설치후 log rotate 후 log 파일이 0 이 되는 문제 해결
증상
webtatic 에서 nginx 패키지를 설치하면 nginx 의 log file 을 날마다 rotate 할수 있도록 /etc/logrotate.d/nginx 파일이 포함되어 있다.
하지만 설정이 잘못 되어 log 를 rotate 한후 사이즈가 0 이 되어 버리고 더 이상의 로그가 남지 않는 치명적인 버그가 있다. (nginx18-1.8.0-1.w6 까지 확인)
해결
이 문제를 해결하려면 다음 절차대로 수행한다.
- /etc/logrotate.d/nginx 파일을 에디터로 오픈
문제 원인은 로그 rotate 후 nginx 에 설정 파일을 다시 읽으라고 SIGUSR1 시그널을 전송하는데 시그널을 받을 nginx 의 pid 파일의 경로를 잘못 설정해 발생한다. 아래의 설정중 /run 을 /var/run 으로 수정하고 저장한다.
postrotate /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true endscript
ls -l /var/log/nginx/*log 를 열어서 로그 파일이 크기가 0 이라면 rotate 후 nginx 가 로그를 못 남기고 있는 상황이므로 재구동한다.
service nginx restart
, multiple selections available,
Related content
nginx log를 rotate 해서 일자별로 관리(logrotate)
nginx log를 rotate 해서 일자별로 관리(logrotate)
More like this
nginx 로드 밸런싱 설정 (load balancing)
nginx 로드 밸런싱 설정 (load balancing)
More like this
nginx POST data 로깅 남기기
nginx POST data 로깅 남기기
More like this
nginx 와 nodejs 연동
nginx 와 nodejs 연동
More like this
nginx unit - 차세대 application server
nginx unit - 차세대 application server
More like this
nginx 업로드 파일 용량 초과 오류 해결 - HTTP 413 client intended to send too large body
nginx 업로드 파일 용량 초과 오류 해결 - HTTP 413 client intended to send too large body
More like this