*AWStats 6.6完全日本語版 [#a37ccc27]

RIGHT:更新日&lastmod();

Webブラウザ(Apache)のアクセスログ解析システムを[[ここ:http://www.bflets.dyndns.org/Tools/AWStatsJpn.html]]から[[AWStats66_Jpn.tar.gz:http://www.bflets.dyndns.org/AWStats66_Jpn.tar.gz]]をDownloadしてくる。


**Jcodeのインストール [#j5c64e73]
事前準備としてJcodeが必要なので[[ここ:http://openlab.ring.gr.jp/Jcode/index-j.html]]からJcode-2.06.tar.gzをDownload

 $ tar zxvf Jcode-2.06.tar.gz
 $ cd Jcode-2.06
 $ perl Makefile.PL
 $ make
 cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
 cp Jcode.pm blib/lib/Jcode.pm
 Manifying blib/man3/Jcode::Nihongo.3pm
 Jcode/Nihongo.pod:1: Unknown command paragraph "=encoding euc-jp"
 Manifying blib/man3/Jcode.3pm
 
 $ make test
 PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0,
 'blib/lib', 'blib/arch')" t/*.t
 t/append.....ok
 t/convert....ok
 t/getcode....ok
 t/h2z........ok
 t/jfold......ok
 t/length.....ok
 t/mime.......ok
 t/new........ok
 t/perl581....ok
 t/regex......ok
 t/tr.........ok
 All tests successful.
 Files=11, Tests=244,  3 wallclock secs ( 2.58 cusr +  0.10 csys =  2.68 CPU)
 
 $ suu
 $ su
 # make install
 Installing /usr/lib/perl5/site_perl/5.8.6/Jcode.pm
 Installing /usr/lib/perl5/site_perl/5.8.6/Jcode/Nihongo.pod
 Installing /usr/share/man/man3/Jcode.3pm
 Installing /usr/share/man/man3/Jcode::Nihongo.3pm
 Writing /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/Jcode/.packlist
 Appending installation info to /usr/lib/perl5/5.8.6/i386-linux-thread-multi/perllocal.pod


**AWStatsのインストール [#od93293c]

 $ tar zxvf AWStats66_Jpn.tar.gz
 $ su
 # cd apache/cgi-bin/
 # mkdir -p awstats/icon
 # cd awstats
 # cp -r /usr/local/src/AWStats66_Jpn/wwwroot/cgi-bin/* .
 # cd icon
 # cp -r /usr/local/src/AWStats66_Jpn/wwwroot/icon/* .
 # cd /usr/local/apache2/cgi-bin/awstats/
 # cp awstats.model_jp.conf awstats.conf

***設定ファイルの編集 [#yb8f64cc]


''/usr/local/apache2/cgi-bin/awstats/awstats.conf''を設定

 ##LogFile="/var/log/httpd/mylog.log"
 LogFile="/usr/local/apache2/logs/access_log.utf8"
 
 ##SiteDomain=""
 SiteDomain="wwwism.dyndns.org"
 
 # 0 - DNSの逆引きを行わない
 # 1 - DNSの逆引きを完全に行う
 # 2 - DNSキャッシュファイルに存在するIPアドレスについてのみのみ逆引きを行う
 # 既定値: 2
 DNSLookup=1
 
 ##DirCgi="/cgi-bin"
 DirCgi="/cgi-bin/awstats"
 
 ##DirIcons="/icon"
 DirIcons="/cgi-bin/awstats/icon"
 
 ##SkipHosts=""
 SkipHosts="127.0.0.1 REGEX[^192.168.10.]"
 
 # 既定値: "auto"
 #
 Lang="jp"

***動作確認 [#nf054f50]

''手動で、utf8形式にログを変換''

 # ./utf8_decode.pl < /usr/local/apache2/logs/access_log  
 > /usr/local/apache2/logs/access_log.utf8


''手動でアクセス解析を実行''

 # ./awstats.pl -config=awstats.conf -update
 Create/Update database for config "./awstats.conf" by AWStats version 6.6   (build 1.887)
 From data in log file "/usr/local/apache2/logs/access_log.utf8"...
 Phase 1 : First bypass old records, searching new record...
 Searching new records from beginning of log file...
 Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
 Jumped lines in file: 0
 Parsed lines in file: 396247
  Found 92276 dropped records,
  Found 29305 corrupted records,
  Found 0 old records,
  Found 274666 new qualified records.


LogFormat=1でcombinedだが、commonログ形式あるとawstats.plでフォーマット異常のエラーが出る。~
httpd.confのCustomLog logs/access_log commonをコメントアウトし、combinedのコメントをはずしておく。

このままだと画像ファイルが表示しない。cgi-bin内のディレクトリはすべてScript扱いなので.jpgや.pngはエラーするのでそれを許可する

''httpd.conf''

 ScriptAlias /cgi-bin/ "/usr/local/apache224/cgi-bin/"
 
 # 以下を追加する
    <Directory /usr/local/apache224/cgi-bin/awstats/icon/>
        AddHandler image/gif .gif
        AddHandler image/jpg .jpg
        AddHandler image/png .png
    </Directory>
 
''アクセスURL''

 http://wwwism.dyndns.org/cgi-bin/awstats/awstats.pl


***定期的起動 [#v61bd9a5]

以下のようなScript作成し、crontabを設定する

''awstats.sh''

 #!/bin/sh
 
 ALOG=/usr/local/apache2/logs/access_log
 UTF8LOG=/usr/local/apache2/logs/access_log.utf8
 UTF8DECODE=/usr/local/apache2/cgi-bin/awstats/utf8_decode.pl
 AWSTATS=/usr/local/apache2/cgi-bin/awstats/awstats.pl
 LOG=/var/log/awstats.log
 $UTF8DECODE < $ALOG > $UTF8LOG
 $AWSTATS -config=awstats.conf -update > $LOG


 30 3 * * * /usr/local/apache2/cgi-bin/awstats/awstats.sh

**参考ページ [#sf18d24d]

http://vine.1-max.net/apache-AWStats.html


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS