Wednesday, October 24, 2012

linux apache2下日志分析工具awstat

 

1.因为我的http://www.pk17s.cn 启用了lvs服务,所以,原来一部windows 2008 r2的服务器有自己装了awstat,现在新的linux apache2也要启用它.awstat是一款很好的网站访问日志分析工具.这台linux服务器为Amazon Linux AMI.AMAZON cloud服务器配置教程..

以下步骤:请注意使用sudo -i管理员模式进行操作.

2.下载解压安装

wget -c http://nchc.dl.sourceforge.net/project/awstats/AWStats/7.0/awstats-7.0.tar.gz

tar zxvf awstats-7.0.tar.gz

mv awstats-7.0/ /var/www/awstats



3.配置apache
vim /etc/httpd/conf/httpd.conf



查找配置:

:/AddHandler cgi-script .cgi



修改为:

AddHandler cgi-script .cgi .pl



4.初始化awstat基本环境


下面第二步选y是因为我第一次安装.pk17s.cn是我的域名.你可以改成你的.

cd /var/www/awstats

perl /var/www/awstats/tools/awstats_configure.pl

 

-----> 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):
> /etc/httpd/conf/httpd.conf

 

-----> 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:
> pk17s.cn

 

-----> 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):
> /var/www/awstats/wwwroot/cgi-bin

 

A SIMPLE config file has been created: /var/www/awstats/wwwroot/cgi-bin/awstats.pk17s.cn.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'pk17s.cn' with command:
> perl awstats.pl -update -config=pk17s.cn
You can also read your statistics for 'pk17s.cn' with URL:
> http://localhost/awstats/awstats.pl?config=pk17s.cn

Press ENTER to finish...


 




创建成功,重启一下httpd.可以打开访问一下:http://localhost/awstats/awstats.pl?config=pk17s.cn 应该可以看到正常页面.


image


如果出现404,则检查/etc/httpd/httpd.conf里的AliasScript awstats的相关路私是否存在.


如果出现pk17s.cn.model.conf相关字样文件找不到,则找一下该文件,放在/var/www/awstats/wwwroot/cgi-bin中即可.或者重新运行前面的pl那一进重新生成配置文件.


5.同步我的windows与linux的lvs的服务器相关配置


吃饭一下,下一篇补上日志栏位及ip数据库.

2 comments:

linux apache2下日志分析工具awstat之二 | pkrss blog said...

[...] pkrss blog 语音新闻王 wordpress blog 站点 Skip to content HomewordpressAmazoncomputer(计算机) ← linux apache2下日志分析工具awstat [...]

Air Bed said...

Hey! Would you mind if I share your blog with my twitter group?
There's a lot of people that I think would really appreciate your content.

Please let me know. Many thanks