| >> HOME >> FC5 MENU >> Apache バーチャルホスト用アクセスログ解析 (AWStats) |
 |
|
|
|
|
|
|
|
|
|
|
| |
|
|
| |
[root@linux ~]# cp -p /etc/awstats/awstats.model.conf /etc/awstats/awstats.virtual.jp.conf 
|
|
|
| |
|
|
| |
[root@linux ~]# vi /etc/awstats/awstats.virtual.jp.conf
:
:
# You can also use a pipe if log file come from a pipe :
# Example: "gzip -d # apacheのアクセスログの場所
# 検索系サイトよりキーワードで検索されてきた場合、文字化が発生することがあります。
# これは、AWStats が utf-8 で作られているものの、キーワードが euc でログに出力される為に発生します。
# 対応として、apacheのアクセスログを utf-8にデコードした後に集計を行うようにします。
# virtual-access_log.utf8は一時的にデコードしたログを保存するファイルの名前です。
LogFile="/var/log/httpd/virtual-access_log.utf8"
:
:
# Example: "myintranetserver"
# Example: "www.domain.com"
# Example: "ftp.domain.com"
# Example: "domain.com"
#
SiteDomain="virtual.jp"
:
:
# 0 - No DNS Lookup
# 1 - DNS Lookup is fully enabled
# 2 - DNS Lookup is made only from static DNS cache file (if it exists)
# Default: 2
#
DNSLookup=1
:
:
# Example: "/var/lib/awstats"
# Example: "../data"
# Example: "C:/awstats_data_dir"
# Default: "." (means same directory as awstats.pl)
#
DirData="."
:
:
# Change : Effective for new updates only
# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.]"
# Example: "localhost REGEX[^.*\.localdomain$]"
# Default: ""
#
#SkipHosts=""
SkipHosts="127.0.0.1 REGEX[^192\.168\.1\.]"
:
:
# Serbian=sr, Slovak=sk, Slovenian=si, Spanish=es, Swedish=se, Turkish=tr,
# Ukrainian=ua, Welsh=cy.
# First available language accepted by browser=auto
# Default: "auto"
#
Lang="jp"
:
:
# Choose if you want the week report to start on sunday or monday
# Possible values:
# 0 - Week start on sunday
# 1 - Week start on monday
# Default: 1
#
FirstDayOfWeek=0
:
:
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# /usr/share/awstats/wwwroot/cgi-bin/conv_weblog_to_utf8.pl \
< /etc/httpd/logs/virtual-access_log \
> /etc/httpd/logs/virtual-access_log.utf8 
|
|
|
| |
|
|
| |
[root@linux ~]# /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -update
Update for config "/etc/awstats/awstats.virtual.jp.conf"
With data in log file "/var/log/httpd/virtual-access_log.utf8"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 0
Found 1821 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 121226 new qualified records.
|
|
|
|
|
|
| |
|
|
| |
[root@linux ~]# mkdir /home/virtual/html/awstats 
|
|
|
| |
|
|
| |
[root@linux ~]# vi awstats-virtual.sh
#!/bin/sh
YEAR=`date --date '1 days ago' +%Y`
MONTH=`date --date '1 days ago' +%m`
/usr/share/awstats/wwwroot/cgi-bin/conv_weblog_to_utf8.pl \
< /var/log/httpd/virtual-access_log \
> /var/log/httpd/virtual-access_log.utf8
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -update
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp \
-output=monthdayvalues -year=$YEAR -month=$MONTH -staticlinks > \
/var/www/html/awstats/$YEAR-$MONTH.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=allhosts -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.allhosts.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=lasthosts -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.lasthosts.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=unknownip -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.unknownip.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=alllogins -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.alllogins.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=lastlogins -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.lastlogins.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=allrobots -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.allrobots.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=lastrobots -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.lastrobots.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=urldetail -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.urldetail.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=urlentry -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.urlentry.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=urlexit -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.urlexit.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=browserdetail -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.browserdetail.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=unknownbrowsers -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.unknownbrowsers.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=unknownos -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.unknownos.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=refererse -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.refererse.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=refererpages -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.refererpages.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=keyphrases -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.keyphrases.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=keywords -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.keywords.html
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=virtual.jp -output=errors404 -staticlinks > \
/home/virtual/html/awstats/awstats.virtual.jp.errors404.html
if [ "$YEAR$MONTH" = $(date +%Y%m) ]; then
mv /home/virtual/html/awstats/$YEAR-$MONTH.html /home/virtual/html/awstats/index.html
fi
|
|
|
| |
[root@linux ~]# chmod 700 awstats-virtual.sh 
|
|
|
| |
|
|
| |
[root@linux ~]# ./awstats-virtual.sh 
|
|
|
| |
|
|
| |
[root@linux ~]# crontab -e
# 毎日 00:00 に自動実行します。
00 00 * * * /root/awstats-virtual.sh > /dev/null 2>&1
|
|
|
 |
|
 |
 |