日期:2014-05-17  浏览次数:20795 次

Apache日志分割及分析

相关软件及下载地址:

1、 cronolog-1.6.2.tar.gz

2、 awstats-6.95.tar.gz

3、 GeoIP-1.4.6.tar.gz

4、 Geo-IP-1.38.tar.gz

5、 Net-XWhois-0.90.tar.gz

6、 QQWry.Dat

7、 IP解析插件

软件说明:

Cronolog -apache日志分割

Awstats –apace日志分析主程序

GeoIP –IP地址分析,来至某个国家并显示国旗

Xwhois及后面 –IP反向解析

详细安装过程:

?

一、安装cronolog日志分割软件:

[root@saas soft]# tar zxvf cronolog-1.6.2.tar.gz

[root@saas cronolog-1.6.2]# ./configure &&make &&make install

[root@saas cronolog-1.6.2]# which cronolog

/usr/local/sbin/cronolog

修改httpd.conf文件

<VirtualHost *>

ServerName www.test.cn

DocumentRoot “/opt/lampp/htdocs/newtest”

CustomLog “|/usr/local/sbin/cronolog /opt/lampp/logs/test_%Y%m%d.log” combined

ErrorLog “|/usr/local/sbin/cronolog /opt/lampp/logs/test_error_%Y%m%d.log”

</VirtualHost>

?

重启apache后在/opt/lampp/logs/目录下可以看到以下格式日志:

-rw-r–r– 1 root root 12021 6月 25 15:01 test_20100625.log

-rw-r–r– 1 root root 718 6月 25 15:00 test_error_20100625.log

日志分割比较简单。。至此就安装完成了。。。以后每天都会在该目录下生成当日的日志文件。

二、安装awstats主程序

[root@saas local]# tar zxvf awstats-6.95.tar.gz -C /usr/local/

[root@saas local]# mv awstats-6.95/ awstats

[root@saas local]# mkdir /etc/awstats

[root@saas local]# mkdir /var/lib/awstats

[root@saas local]# chown -R apache /var/lib/awstats/

[root@saas local]# chown -R apache /usr/local/awstats/

[root@saas local]# /usr/local/awstats/tools/awstats_configure.pl

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):

? /opt/lampp/etc/httpd.conf #http.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: d