Two tools for monitoring Apache logs
Apache Log analysis Tool Webalizer Awstat
Prepare webalizer-2.23-05-src.tgz awstats-7.0.tar.gz perl-5.16.3.1603.tar.gz
Install Apache
[Root@lly ~]# Mkdir/mnt/cdrom
[root@lly ~]# mount/dev/cdrom/mnt/cdrom Mounted optical drive
[Root@lly ~]# cd/mnt/cdrom/server/
[Root@lly server]# RPM-IVH apr-1.2.7-11.el5_3.1.i386.rpm
[Root@lly server]# rpm-ivh postgresql-libs-8.1.11-1.el5_1.1.i386.rpm (Apr-util belongs to this package)
[Root@lly server]# RPM-IVH apr-util-1.2.7-7.el5_3.2.i386.rpm
[Root@lly server]# rpm-ivh httpd-2.2.3-31.el5.i386.rpm (Installation httpd, dependent on apr-1.2.7-11.el5_3.1.i386.rpm and RPM-IVH postgresql-libs-8.1.11-1.el5_1.1.i386.rpm or installed with Yum)
[root@lly server]# Service httpd start (starting httpd)
Install Webalizer
[Root@lly ~]# tar zxvf webalizer-2.23-05-src.tgz-c/usr/local/src/
[Root@lly ~]# cd/usr/local/src/webalizer-2.23-05/
[Root@lly webalizer-2.23-05]# less INSTALL (view installation instructions)
[root@lly webalizer-2.23-05]#./configure--sysconfdir=/etc (default installation, installation to usr/local directory, indicating configuration file to/etc directory)
[Root@lly webalizer-2.23-05] #make
[root@lly webalizer-2.23-05] #make Install
[root@lly webalizer-2.23-05]mkdir/var/www/html/log (create log file as output directory for Webalizer analysis results, as mentioned in the following script)
Assuming that the Web server host name is www.test.com, the statistics site domain name is www.test.com, the access log is/var/log/httpd/access_log, we will webalizer the results of the analysis output to/var/www/html/ Log below.
Then we can create a script for log monitoring.
But the script only executes once, Webalizer will produce a record, want to monitor its periodic information, need to carry out the scheduled task, so add the scheduled task first
[Root@lly WEBALIZER-2.23-05]CD
[Root@lly ~]# Vi/etc/crontab
Add a directory that can also modify the scheduled task, which is changed to Cron.web