본문 바로가기
Linux/Log 관리

Apache Web Log 설정

by 프리윙즈 2022. 2. 15.
728x90
반응형

Apache Web Log는 httpd.conf를 수정하여 LogLevel 및 Log 저장 경로를 설정합니다.

 

경로 : /etc/httpd/conf/httpd.conf

 

ErrorLog "logs/error_log"   -> ErrorLog 경로

 

#

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

#

LogLevel warn   -> 오류 로그의 경우 warn 이상의 priority , error, critical, alert, emergency 해당되는

                          로그를 액세스 로그에는 combined포맷으로 기록

 

<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  

          ->  combined포맷은 LogFormat 지정자로 지정되어 있음

포맷 의미 포맷 의미
%h 원격호스트 %>s 최종 상태
%l 원격 로그인 %b 응답 바이트
%u 원격 사용자 %{Refer}I 레퍼러 정보
%t 요청 시간 %{User-Agent}I 사용자의 브라우저 정보
%r 요청 메시지의 첫번째 라인

    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>

CustomLog "logs/access_log" combined   -> accesslog 경로  (실제위치 : /var/log/httpd)

</IfModule>

 

 

반응형

댓글