|
1: 2008-12-21 (日) 03:29:18 admin |
| + | *AWStats [#tf79f213] |
| + | -WWW用ログ解析ツール |
| + | **Links [#o82d18a2] |
| + | - http://awstats.sourceforge.net/ |
| + | - 日本語化バージョン http://www.bflets.dyndns.org/Tools/AWStatsJpn.html |
| | | |
| + | |
| + | **インストール [#m89e8fe7] |
| + | *** [[Jcode.pm]] のインストール [#d8f279e9] |
| + | - Perl用の日本語処理ライブラリ jcode.pl の後継 |
| + | - http://openlab.ring.gr.jp/Jcode/index-j.html |
| + | |
| + | # zcat Jcode-*.tar.gz | tar xvf - |
| + | # cd Jcode-* |
| + | # perl Makefile.PL; make; make install |
| + | |
| + | *** AWStatsのインストール [#qb67a66d] |
| + | -展開ディレクトリを /usr/local/awstats にする. |
| + | |
| + | # chown -R www.www /usr/local/awstats |
| + | # cd /usr/local/awstats/wwwroot/cgi-bin |
| + | # ln -s awstats.model_jp.conf awstats.model.conf |
| + | # cd ../../tools |
| + | # perl awstats_configure.pl |
| + | |
| + | -----> Define config file name to create |
| + | What is the name of your web site or profile analysis ? |
| + | Example: www.mysite.com |
| + | Example: demo |
| + | Your web site, virtual server or profile name: |
| + | > NSL |
| + | |
| + | -----> Define config file path |
| + | In which directory do you plan to store your config file(s) ? |
| + | Default: /etc/awstats |
| + | Directory path to store config file(s) (Enter for default): |
| + | > /usr/local/etc/awstats |
| + | |
| + | ** 設定 [#w4532639] |
| + | *** Apacheの設定 [#w9560227] |
| + | -httpd.conf の CustomLog を ''combined'' にする.HTTPS を動かしている場合は SSLのログ(ssl.conf)の CustomLog も combined で access_log に書き込むようにする. |
| + | |
| + | # Per-Server Logging: |
| + | # The home of a custom SSL log file. Use this when you want a |
| + | # compact non-error SSL logfile on a virtual host basis. |
| + | #CustomLog /usr/local/apache/logs/ssl_request_log \ |
| + | # "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" |
| + | CustomLog /usr/local/apache/logs/access_log combined |
| + | |
| + | - 以下の設定が自動的に apache の ''httpd.conf'' に追加される |
| + | |
| + | # |
| + | # Directives to allow use of AWStats as a CGI |
| + | # |
| + | Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/" |
| + | Alias /awstatscss "/usr/local/awstats/wwwroot/css/" |
| + | Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/" |
| + | ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/" |
| + | |
| + | # |
| + | # This is to permit URL access to scripts/files in AWStats directory. |
| + | # |
| + | <Directory "/usr/local/awstats/wwwroot"> |
| + | Options None |
| + | AllowOverride None |
| + | Order allow,deny |
| + | Allow from all |
| + | </Directory> |
| + | - apache の再起動 |
| + | |
| + | *** AWStatsの設定 [#k66ad02a] |
| + | - 設定ファイル |
| + | |
| + | # vi /usr/local/etc/awstats/awstats.NSL.conf |
| + | LogFile="/var/log/awstats_log.utf8" |
| + | SiteDomain="www.nsl.tuis.ac.jp" |
| + | |
| + | # chmod o+rx /usr/local/etc/awstats |
| + | # chmod o+r /usr/local/etc/awstats/* |
| + | |
| + | - 結果を格納するディレクトリを作る |
| + | |
| + | # mkdir /var/lib/awstats |
| + | # chown www.www /var/lib/awstats |
| + | # chmod o-rwx,g+s /var/lib/awstats |
| + | |
| + | - 最初の実行 |
| + | |
| + | # /usr/local/awstats/wwwroot/cgi-bin/utf8_decode.pl < /usr/local/apache/logs/access_log > /var/log/awstats_log.utf8 |
| + | # /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=NSL -update |
| + | - チェック |
| + | http://www.nsl.tuis.ac.jp/awstats/awstats.pl?config=NSL |
| + | |
| + | *** cron の設定 [#j5f88968] |
| + | - ''awstats.cron'' を編集して,''/etc/cron.daily'' にコピー |
| + | - サンプル |
| + | |
| + | #! /usr/bin/perl |
| + | # 完全日本語版AWStats用サンプルcronファイル |
| + | # |
| + | # ファイルパス等は自分の環境に合わせて書き直して下さい。 |
| + | # httpのログファイルをデコードした上で一時ディレクトリに格納します。 |
| + | # access_log.utf8は一時的にデコードしたログを保存するファイルの名前です。 |
| + | |
| + | system(" /usr/local/awstats/wwwroot/cgi-bin/utf8_decode.pl < /usr/local/apache/logs/access_log > /var/log/awstats_log.utf8"); |
| + | #system(" /bin/cat < /dev/null > /usr/local/apache/logs/access_log"); |
| + | |
| + | # awstats.plが切り詰めないオリジナルのログを切り詰めます。 |
| + | open(LOG,"+</usr/local/apache/logs/access_log"); |
| + | truncate(LOG,0); |
| + | close(LOG); |
| + | |
| + | # Ver.5.0から、更新処理を別途走らせる必要ができたらしい.... |
| + | system(" /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=NSL -update > /dev/null"); |
| + | #system(" /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=NSL -update"); |
| + | |
| + | # awstats.plを走らせ、htmlファイルを出力します。 |
| + | # 必須ではありませんが、awstats.plを直接参照させるよりも、htmlに出力して表示す |
| + | # る方が、良好なパフォーマンスが得られます。 |
| + | system(" /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=NSL -output > /home/apache/htdocs/awstats_log/index.html"); |
| + | |
| + | # アクセス可能になるように出力したhtmlファイルの権限を変更 |
| + | system("chown www.www /home/apache/htdocs/awstats_log/index.html"); |
| + | |
| + | # chmod a+rx /etc/cron.daily/awstats.cron |
| + | # mkdir /home/apache/htdocs/awstats_log |
| + | # chown www.www /home/apache/htdocs/awstats_log |