AWStats

Web のログも FTP のログも Mail のログも解析できる高機能ログ解析スクリプト AWStats を入れてみました.対象は apache/2.0.50 と vsftpd/2.0.1 .注意点を挙げる.5.0 の日本語ドキュメントもあるので参考に.

  • tools/configure.pl を実行すると色々と設定ファイルを吐いてくれるぞ.httpd.conf までいじってくれたりする.
  • rpm になってるってことで 6.1 を使ってしまうと LogFormat の日付の部分のフォーマット(%time3) が違う*1ので要注意だ.6.2 では直ってるので 6.2 を使おう.FTP ログ解析用の設定は FAQ参照.vsftpd のログは標準 xferlog 形式(wu-ftpd 互換).
xferlog_enable=YES
xferlog_std_format=YES
  • update は現在の日付より古い記録は無視するようだ(どっかに書いてあったんだけど).
  • 解析結果を html に output する場合は tools/awstats_buildstaticpages.pl が便利.cron はこんな感じで何とかなりそう.
 #!/bin/bash
 cd /path/to/awstats/tools/
 ./awstats_buildstaticpages.pl\
        -update\
        -staticlinks\
        -lang=jp\
        -awstatsprog=/path/to/awstats/wwwroot/cgi-bin/awstats.pl\
        -config=myvirtualhostname\
        -dir=/documentroot/awstats-result/

dir で指定したディレクトリに awstats.myvirtualhostname.*.html で出力される.

apacheaccess_log についてはログフォーマットを変えることになる(common → combined) ので analog との共存ができなくなるのだ.これで月曜に analog いれた意味が消滅.

*1:xferlog は "Day Mon dd hh:mm:ss yyyy" で出てるけど,6.1 の %time3 は "Mon dd hh:mm:ss yyyy" で解析しようとする