Apache2.4 ログローテーションの設定

httpd.conf に以下のような記述を入れてます。
プロキシされてるサーバーなので、SSLの設定入れてませんが、必要な場合、ssl.confに同様の設定入れるとよいです。

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    ### last %D means micro second ###
    LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
    LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%{X-Forwarded-For}i %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

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    SetEnvIf User-Agent "ELB-HealthChecker.*" nolog
    #CustomLog "logs/access_log" combined env=!nolog
    CustomLog "|/usr/sbin/rotatelogs /home/Log/apache/access_log_%Y%m%d 86400 540" combined env=!nolog
</IfModule>

コメントを残す