现在时间23点22分,刚才装了一个awstats的网络监控的一个东西,其实就是分析日志的一个小玩意儿挺好玩的,讲一下如何安装。
这东西挺好装的基本上不费什么时间,从awstats.sourceforge.net 找到了一个比较新的版本是6.5的首先解压,把awstats解到
/usr/local/的下面,在tools里面有一个配置文件叫awstats_configure.pl执行它,根据它的提示你可以回答:
www# ./awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 1.6) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
-----> Running OS detected: Linux, BSD or Unix
-----> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /usr/local/etc/apache21/Includes/ykvod.2288.conf
-----> Check and complete web server config file '/usr/local/etc/apache21/Includes/ykvod.2288.conf'
AWStats directives already present.
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? 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:
> ykvod.2288.org
-----> 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):
> /usr/local/etc/awstats
-----> Create config file '/usr/local/etc/awstats/awstats.ykvod.2288.org.conf'
Config file /usr/local/etc/awstats/awstats.ykvod.2288.org.conf created.
-----> 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=ykvod.2288.org
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...
A SIMPLE config file has been created: /usr/local/etc/awstats/awstats.ykvod.2288.org.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'ykvod.2288.org' with command:
> perl awstats.pl -update -config=ykvod.2288.org
You can also read your statistics for 'ykvod.2288.org' with URL:
> http://localhost/awstats/awstats.pl?config=ykvod.2288.org
Press ENTER to finish...
也无非就是一些你的虚拟主机的配置文件在什么位置,与你的虚拟主机叫什么名,还有就是你的配置文件的存放位置就这些。
等回答完这些问题之后,把相应的目录复制到相应的目录里面去,比方说在wwwroot里面的cgi-bin目录里面的文件就要放在你虚拟主机的cgi-bin里面。
还有就是什么图标什么的放在你的public_html的下面。
因为我用的是squid的反向代理apache所以就不能让awstats来读取我虚拟主机的日志,不然的也分不清谁是谁的,直接应该读取squid的日志
swstats默认要求读取日志的格式必需是combined,没有关系swstats可以读取很多种格式我选择的是第4种LogFormat=4,这些都是需要注意的,除此以外可以根据自己的需要来进行配置。
最后就是测试结果:
www# perl awstats.pl -update -config=ykvod.2288.org
Update for config "./awstats.ykvod.2288.org.conf"
With data in log file "/usr/local/apacheusers/ykvod.2288.org/log/aclearcase/" target="_blank" >ccess_log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 23)
Jumped lines in file: 23
Found 23 already parsed records.
Parsed lines in file: 0
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
像这样的话基本上就没有问题了
打开firefox之后输入http://ykvod.2288.org/cgi-bin/awstats.pl?config=ykvod.2288.org来看一下结果吧!
顺便说一下swtats会去修改你的httpd.conf文件,我直接删掉了因为我用的不是httpd.conf我用的是虚拟主机的配置文件。