리눅스
[Apache] 아파치 액세스 로그 설정
변군이글루
2020. 12. 15. 14:56
반응형
아파치 액세스 로그 설정
아파치 설정(httpd.conf) 편집 - vcombined 추가
$ vim /usr/local/apache2/conf/httpd.conf
...
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t %v:%p \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %Ts %Dμs" vcombined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
...
가상호스트(httpd-vhosts.conf) 편접
$ vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
...
CustomLog "|/usr/sbin/cronolog /logs/access/test.sangchul.kr-%Y%m%d.log" vcombined
ErrorLog "|/usr/sbin/cronolog /logs/error/test.sangchul.kr-%Y%m%d.log"
...
로그 확인
$ tail -f test.sangchul.kr-20201215.log
10.10.10.10 - - [15/Dec/2020:14:42:28 +0900] test.sangchul.kr:80 "GET /index.html HTTP/1.1" 200 55 "-" "curl/7.61.1" 0s 5475μs
728x90
반응형