카테고리 없음

Nginx Log rotate 하기

KraZYeom 2012. 10. 18. 10:52
반응형

Crontab 등록하지 않고 log 파일을 날짜별로 rotate 시킬 수 있는 방법.

http://applejara.tistory.com/entry/Cronolog-%EC%84%A4%EC%A0%95

 

cronolog 설치 : http://sangchul.kr/4808647

nginx cronolog 적용 : https://gist.github.com/2891895


위 방법들을 참조해서 작용하면 아래와 같이 날짜별로 구분되어 로그가 저장된다. 


[root nginx]# ls -al

total 64

drwxr-xr-x  2 root  root 4096 Oct 18 00:21 .

drwxr-xr-x 18 root  root 4096 Oct 17 04:02 ..

-rw-r--r--  1 root  root  464 Oct 17 07:34 access_20121017.log

-rw-r--r--  1 root  root 1639 Oct 18 00:22 access_20121018.log

-rw-r-----  1 nginx adm     0 Oct 17 04:02 access.log

prw-r--r--  1 root  root    0 Oct 18 00:22 access_log_pipe

-rw-r--r--  1 root  root  523 Oct 17 07:34 error_20121017.log

-rw-r--r--  1 root  root 2090 Oct 18 00:22 error_20121018.log

-rw-r-----  1 nginx adm     0 Oct 17 04:02 error.log

prw-r--r--  1 root  root    0 Oct 18 00:22 error_log_pipe

반응형