apache 로그 이미지 제외

2017. 3. 31. 13:56개발/서버

log_config_module 수정


<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 \"%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>


    #

    # The location and format of the access logfile (Common Logfile Format).

    # If you do not define any access logfiles within a <VirtualHost>

    # container, they will be logged here.  Contrariwise, if you *do*

    # define per-<VirtualHost> access logfiles, transactions will be

    # logged therein and *not* in this file.

    #


    

    SetEnvIf Request_URI \.gif image-request

    SetEnvIf Request_URI \.jpg image-request

    SetEnvIf Request_URI \.png image-request

    SetEnvIf Request_URI \.bmp image-request

    SetEnvIf Request_URI \.swf image-request


    

    CustomLog "logs/access_log" common


    #

    # If you prefer a logfile with access, agent, and referer information

    # (Combined Logfile Format) you can use the following directive.

    #

    #CustomLog "logs/access_log" combined

 </IfModule>


Custom Log 설정


CustomLog "|/usr/local/cronlog/sbin/cronolog /usr/local/apache/logs/xxx-access_%Y%m%d.log" combined env=!image-request


'개발 > 서버' 카테고리의 다른 글

apache favicon.ico HTTP/1.1" 404 에러 처리  (0) 2019.01.05
dhcp로 받아온 ip를 캐쉬 제거  (0) 2018.06.14
cronolog 설치 및 설정  (0) 2017.03.29
Centos7 ifconfig  (0) 2017.03.26
ping 명령으로 원격 호스트 확인  (1) 2017.03.21