Apache のログファイルの設定

combined log

Apache で HTTP 接続でも HTTPS 接続でも同じように combined ログが記録さ れるようにするには、以下のようにすればよい。

まず、 httpd.conf で以下の記述が有効になるようにする。

CustomLog "/var/log/httpd/access_log" combined
logio モジュールが有効になっていなければ有効にする。
LoadModule logio_module lib/httpd/mod_logio.so

次に、 httpd-ssl.conf に以下の記述を追加する。

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
以下のようになっていればよい。
##
## SSL Virtual Host Context
##



#   General setup for the virtual host
DocumentRoot "/usr/pkg/share/httpd/htdocs"
ServerName aaa.bbb.ccc.ddd:443
ServerAdmin xxx@yyy.zzz
ErrorLog "/var/log/httpd/error_log"
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
TransferLog "/var/log/httpd/access_log"

そして、 Apache を再起動すればよい。

combinedio log

combinedio ログを記録するようにするには以下のようにする。

まず、 httpd.conf を以下のように変更する。

#CustomLog "/var/log/httpd/access_log" combined
CustomLog "/var/log/httpd/access_log" combinedio

次に、 httpd-ssl.conf を以下のように変更する。

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %I %O"

そして、 Apache を再起動すればよい。




HTML file generated by Kinoshita Daisuke.