Recent changes

2013-04-14 2013-04-02 2013-02-17 2013-01-29 2013-01-20 2013-01-18 2012-12-08 2012-11-06 2012-09-04 2012-08-02

AWStats

Perlなログ統計管理ソフト。再挑戦。 なんかいろいろごちゃごちゃ書いてるけどvisitorsの方が軽いし早いし脆弱性もないしシンプルなのでお勧めですよ

目次

インストールから導入まで

玄箱Debianの場合

インストール

とりあえずDownLoadして、こんな感じにおいてみた。

wwwroot:/hogehoge/awstats

で、

perl configure.pl

としたら、ほんとは/usr/local/awstatsにおくんだYO!ばーがばーが! といわれたので置きなおし。

cd /usr/local
wget http://awstats.sourceforge.net/files/awstats-6.2.tgz
tar -xzvf awstats-6.2.tgz
mv ./awstats-6.2 ./awstats

で、

cd ./awstats/tools
perl awstats_configure.pl

おう。よくわからんがhttpd.conf見つけてエイリアスとか作ってくれるみたいです。 とりあえずy。

-----> 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:

サイト名じゃね?sonata.zive.netとか入れてみる。

-----> 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):

(Enter for default)ならEnterおすしかねぇ。

-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=sonata.zive.net
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue... 

翻訳してみると。

僕たんうんけだからcron様にスケジュール登録できなかったよ。
root様自分で登録しちゃってください。こんな感じです。
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=sonata.zive.net
それか、(以下略

なんだって。というわけで自分で実行してみる。

perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=sonata.zive.net

すると、

Error: AWStats database directory defined in config file by 'DirData'
parameter (/var/lib/awstats) does not exist or is not writable.
Setup ('/etc/awstats/awstats.sonata.zive.net.conf' file, web server or  permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

configファイルのDirDataの設定が違うっぽい。っていうか(/var/lib/awstats)って。/usr/local/awstatsを指定したのはあんただろ?というわけで書き換えてみる。

cd /etc/awstats/
vi awstats.sonata.zive.net.conf

/DirDataでDirData行を検索して/usr/local/awstatsに置き換え。:wqで保存。 そして再度さっきのplを実行してみる。

Update for config "/etc/awstats/awstats.sonata.zive.net.conf"
With data in log file "/var/log/httpd/mylog.log"...
Error: Couldn't open server log file "/var/log/httpd/mylog.log" : No such  file or directory
Setup ('/etc/awstats/awstats.sonata.zive.net.conf' file, web server or  permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs'  directory).

、、。あっそ。 とりあえずこんな感じに置き換えてみる

LogFile="perl /usr/local/awstats/tools/logresolvemerge.pl /usr/local/apache2/logs/access_log* |"

LogのFormatを途中からcombindにしたせいでエラーがでていたので 昔のアクセスログを消して再度チャレンジ。したらすごく長い間とともに成功の予感。

Update for config "/etc/awstats/awstats.sonata.zive.net.conf"
With data in log  file "perl /usr/local/awstats/tools/logresolvemerge.pl /usr/local/apache2/logs/ access_log* |"...
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: 34485
 Found 47 dropped records,
 Found 597 corrupted records,
 Found 0 old records,
 Found 33841 new qualified records.

で、ブラウザで見てみる。とその前に最初にhttpd.conf書き換えたからApacheをリブート。

/usr/local/apache2/bin/apachectl restart

おりゃ。って・・マニュアル読んだら、実際のファイルを作るにはまだ手順を踏む必要が あったのね・・・

/usr/local/awstats/tools/awstats_buildstaticpages.pl -config=sonata.zive.net -lang=ja

とする。

できたー!!!!!

その後
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=sonata.zive.net
/usr/local/awstats/tools/awstats_buildstaticpages.pl -config=sonata.zive.net -lang=ja

で更新できるYO!

関連リンク

ご意見をば。