メンチカツ、美味しい
kaiman のすべての投稿
CentOS6 ログ
従来の過去ログと変わったので戻す
/etc/logrotate.conf
datext
↑これをコメントアウト
awstats 個人的メモ
久しぶりにインストールしてはまったのでメモ(CentOS6ミニマム)
yum install awstats
(RPM Forgeインストール済)
・日付の修正
vi /var/www/awstats/awstats.pl
9932行目
#$Message[5] $MonthNumLib{$MonthRequired} $YearRequired”;
“$YearRequired $Message[6]“.$MonthNumLib{$MonthRequired};
12611行目
# print( $MonthRequired eq ‘all’
# ? “$Message[6] $YearRequired”
# : “$Message[5] ”
# . $MonthNumLib{$MonthRequired}
# . ” $YearRequired”
# );
print ($MonthRequired eq ‘all’? \
“$YearRequired $Message[6]“:”$YearRequired $Message[6]“.$MonthNumLib{$MonthRequired});
・文字化けの対策
Jcodeインストール(入っているなら飛ばしてください)
cpan Jcode
YAMLが足りないと言われる^^;
再度挑戦
make が通らないと言われる
悩む。
forceでインストールするも、失敗
色々調べて、Test::Moreこの辺のモジュールかなぁと判断
cpan Test::More
そして、再度
cpan Jcode
いけました
# cpan Jcode
# vi /var/www/awstats/awstats.pl
21行目
use Jcode;
7796
sub DecodeEncodedString {
my $stringtodecode = shift;
$stringtodecode =~ tr/\+/ /s;
$stringtodecode =~ s/%([A-F0-9][A-F0-9])/pack(“C”, hex($1))/ieg;
$stringtodecode =~ s/["']//g;
Jcode::convert(\$stringtodecode, “utf8″);
rm /etc/awstats/awstats.localhost.localdomain.conf
rm /etc/awstats/awstats.`hostname`.conf
cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.google.com.conf
ドメイン部分は自分の環境で書き換え
僕の環境は複数のサイトを解析するために
サブドメインで、切り分けています a.google.com b.google.com みたいに
vi /etc/awstats/awstats.google.com.conf
SiteDomain=”localhost.localdomain”
↓
SiteDomain=”a.google..com”
HostAliases=”localhost 127.0.0.1 ]”
除外したいアクセアス元を記述
DNSLookup=2
↓
DNSLookup=1
#LoadPlugin=”geoipfree”
↓
LoadPlugin=”geoipfree”
vi /etc/httpd/conf.d/awstats.conf
任意の環境に設定をする
vi awstats.sh
#!/bin/sh
logfile=`grep ^LogFile /etc/awstats/awstats.$1.conf|sed -e ‘s/LogFile=”\([^ ]*\)”/\1/p’ -e d`
for log in `ls $logfile*|sort -r`
do
`rpm -ql awstats|grep “awstats\.pl”` \
-config=$1 -update -logfile=$log
done
最初に動かす
sh awstats.sh a.google.com
http://Webサーバー名/awstats/awstats.p
これで見れる