[아파치] access.log 설정

Programing 2013.04.10 09:18 Posted by 애플자라

access.log를 보면 이미지부터 js, css 모두 출력해주는 것을 볼 수 있다.

그런 파일들이 필요한 사람들도 있겠지만.. 나는 필요 없다.

 

httpd.conf의 IfModule log_config_module부분을 살펴보면 access_log에 출력할 확장자를 필터 할 수 있는 기능이 있다.

분홍색 음영부분이 설정된 부분이다.

 

 

<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 \"%{Referer}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.
    #
#    CustomLog "logs/access.log" common

SetEnvIf Request_URI \.gif img-nosave
SetEnvIf Request_URI \.jpg img-nosave
SetEnvIf Request_URI \.png img-nosave
SetEnvIf Request_URI \.css img-nosave
SetEnvIf Request_URI \.js img-nosave

    CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/access.log.%Y%m%d 86400" combined env=!img-nosave

    #
    # 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>

<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 \"%{Referer}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.
    #
#    CustomLog "logs/access.log" common

SetEnvIf Request_URI \.gif img-nosave
SetEnvIf Request_URI \.jpg img-nosave
SetEnvIf Request_URI \.png img-nosave
SetEnvIf Request_URI \.css img-nosave
SetEnvIf Request_URI \.js img-nosave

    CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/access.log.%Y%m%d 86400" combined env=!img-nosave

    #
    # 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>

 출처 - http://cipleme.tistory.com/entry/아파치-accesslog-설정

댓글을 달아 주세요