Tina

아파치 로그 파일 생성

밍밍이

밍밍이

Feb 07, 2021

{아파치가 설치된 경로}/httpd.conf 파일에서 log_config_module이 아래처럼 주석이 없는 것을 확인 후 (기본 설정이면 주석이 없다.)

log_config_module 파일

LoadModule log_config_module modules/mod_log_config.so

<IfModule log_config_module> 안에서 이렇게 되어있는 것을

CustomLog "logs/access.log" common

이렇게 바꾸면

CustomLog "|bin/rotatelogs.exe logs/%Y%m%d_access.log 86400" combined

하루(86400초) 마다 파일이 새로 생성되고

이렇게 바꾸면

CustomLog "|bin/rotatelogs.exe logs/%Y%m%d_access.log 100M" combined

100MB 마다 파일이 새로 생성된다.

Windows 운영체제에선 반드시 rotatelogs 다음에 .exe 를 붙여주어야 한다. https://stackoverflow.com/questions/17201679/apache-2-4-4-rotatelogs-error-parameter-is-incorrect

다른 것은 달라질 것이 없으니 Apache2.4 문서를 참고하면 된다. https://httpd.apache.org/docs/2.4/en/programs/rotatelogs.html

참고

https://floor5th.tistory.com/86 https://bearpro.tistory.com/6