1、由于httpd的log文件默认是/var/log/httpd/access.log,
所以要修改/etc/awstats/awstats.lingling.conf文件里的LogFile:
把LogFile="/var/log/httpd/mylog.log"改为LogFile="/var/log/httpd/access_log"
或者LogFile="var/log/access_log.%YYYY-0%MM-0%DD-0.log"
2、然后,手动更新一下:
# cd /usr/local/awstats/wwwroot/cgi-bin/
# perl awstats.pl –update –config=lingling
或者:# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=lingling
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.lingling.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
出错:忘记了创建awstats的默认数据存放目录
解决:# mkdir –m 755 /var/lib/awstats
# perl/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=lingling
Create/Update database for config "/etc/awstats/awstats.lingling.conf" by AWStats version 7.0 (build 1.976)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 33664)
Jumped lines in file: 33664
Found 33664 already parsed records.
Parsed lines in file:7
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 7 old records,
Found 0 new qualified records.
3、打开浏览器,用awstats分析日志:
?config=lingling
分析结果如下图:
4、可以将更新的命令作为执行计划,使其每天执行一次,方便分析前一天的日。
# crontab –e
10 1 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=lingling > /dev/null 2&>1