| [root]# gzip -d webalizer-2.01-10-src.tar.gz [root]# tar xvf webalizer-2.01-10-src.tar | 
| [root]# configure --with-language=japanese loading cache ./config.cache checking for gcc... (cached) gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... (cached) yes checking whether gcc accepts -g... (cached) yes checking whether ln -s works... (cached) yes checking for a BSD compatible install... (cached) /usr/bin/install -c checking how to run the C preprocessor... (cached) gcc -E checking whether char is unsigned... (cached) no checking for main in -l44bsd... (cached) no checking for main in -lm... (cached) yes checking for main in -lz... (cached) yes checking for gzrewind in -lz... (cached) yes checking for main in -lpng... (cached) yes checking for gdImagePng in -lgd... (cached) yes checking for gd.h... (cached) /usr/local/include checking for getopt.h... (cached) yes checking for math.h... (cached) yes checking default config dir... (cached) /etc checking for language file... yes - japanese creating ./config.status creating Makefile linking ./lang/webalizer_lang.japanese to webalizer_lang.h [root]# make gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c webalizer.c gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c hashtab.c gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c linklist.c gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c preserve.c gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c dns_resolv.c gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c parser.cgcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c output.cgcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -I/usr/local/include -c graphs.c gcc -o webalizer webalizer.o hashtab.o linklist.o preserve.o parser.o output.o dns_resolv.o graphs.o -lgd -lpng -lz -lm rm -f webazolver ln -s webalizer webazolver [root]# make install 以下略 | 
| [root]# webalizer -p -c /usr/local/bin/webalizer.conf /var/log/httpd/access.log -o /home/webalizer/ Webalizer V2.01-10 (Linux 2.4.22-0vl2.14) Japanese Using logfile /var/log/httpd/access.log (clf) Creating output in /home/webalizer/ Hostname for reports is 'miya0.dyndns.org' Reading history file... webalizer.hist Reading previous run data.. webalizer.current Warning: Truncating oversized username *注1 Skipping bad record (1) Saving current run data... [08/29/2004 12:35:11] Generating report for August 2004 Generating summary report Saving history information... 382 records (1 bad) in 0.15 seconds | 
| d30xxxxxxxx.ne.jp - - [29/Aug/2004:02:14:39 +0900] "GET /oil/oil.html HTTP/1.1" 200 48605 48922 "http://www.google.co.jp/search?q=%E3%83%87%E3%83%95%E3%82%AA%E3%82%A4%E3%83%AB%E3%80%80%E7%B2%98%E5%BA%A6%E3%80%80bp&hl=ja&lr=&ie=UTF-8&start=10&sa=N" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" | 
| #!/usr/bin/env perl use Jcode; open (IN ,$ARGV[0]); while ( | 
| [root]# mojibake.pl access.log > access-euc.log | 
| d30xxxxxxxx.ne.jp - - [29/Aug/2004:02:14:39 +0900] "GET /oil/oil.html HTTP/1.1" 200 48605 48922 "http://www.google.co.jp/search?q=デフオイル 粘度 bp&hl=ja&lr=&ie=UTF-8&start=10&sa=N" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" | 
| 
#!/bin/bash
#環境変数セット
#
#日付(年月日 20040829) ファイル作成に使おうと思った(未使用)
datenow=`date +%Y%m%d`
#日付(年月 200408) ファイル作成に使用
monthnow=`date +%Y%m`
#access.logのある場所を指定。最後に / は付けない
inputdir=/var/log/httpd
#webalizerが出力する先を指定。最後に / を付ける
outputdir=/home/localhost/webalizer/
#EUCから SJISへ変換したとき別ファイルへ書き出しているので、
#index.html内に記述するジャンプ命令を書く
jumpurl='<html><meta http-equiv="refresh" content="0;url=index-sjis.html"><html>'
#access.logを Shift_JISより EUCへ変換
/usr/local/bin/mojibake.pl $inputdir/access.log > $inputdir/tmp-euc.log
#access_年月.logというファイルへ、
#EUC変換した後の access.logを追記書き込み
cat $inputdir/tmp-euc.log >> $inputdir/access_$monthnow.log
#access.logは消す
echo > $inputdir/access.log
#414の errorコードがある行以外の 10列目以外を tmp-年月-euc.logへ書きだし
#mod_logioを組み込んで、アクセスコード 要求バイト数 実転送バイト数の並び
#になっている之場合だけ必要。普通の人は、以下の 1行をコメントアウト外し、
#その下 4行はコメントアウトにする。
#grep -v " 414 " $inputdir/tmp-euc.log > $inputdir/tmp-$monthnow-euc.log
grep -v " 414 " $inputdir/tmp-euc.log | \
awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$11,$12,$13,$14,$15,$16, \
$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30}' \
> $inputdir/tmp-$monthnow-euc.log
#webalizerを実行
#追記モード(-p),confファイル指定(-c),出力ディレクトリー指定(-o)
/usr/local/bin/webalizer -p \
-c /usr/local/bin/webalizer.conf \
$inputdir/tmp-$monthnow-euc.log -o $outputdir
#index.htmlを EUCから SJISへ変換。
#index-sjis.htmlというファイルへ書き出し。
/usr/bin/iconv -f EUCJP -t SJIS $outputdir/index.html | \
sed -e s/.html/-sjis.html/g \
> $outputdir/index-sjis.html
#usage_200407.htmlなどを EUCから SJIS変換。
#usage_200407-sjis.htmlへ書き出し。
/usr/bin/iconv -f EUCJP -t SJIS $outputdir/usage_$monthnow.html \
> $outputdir/usage_$monthnow-sjis.html
#index.htmlの中身を jumpurlにする
echo $jumpurl > $outputdir/index.html
 | 
| [root]# crontab -l 0 0 * * * /usr/local/bin/access-webalizer.sh | 
| 
<Directory "/home/webalizer">
    Order deny,allow
    Deny from all
    Allow from 192.168.0.0/255.255.255.0 127.0.0.1
</Directory>
 |