AWStats log analysis system
1.PerI language developed an open source log analysis system
2 can be used to analyze access logs Apache, Samba, Vsftpd, IIS servers, etc.
The information in conjunction with programs such as crond task service can log content analysis on a regular basis
AWStats log analysis system deployment
AWStats Kit Share Link (no password)
https://pan.baidu.com/s/1hhYmwIBdvqwVHZHcaB4dMQ
Step 1: Install and configure Apache DNS service
1. Install Service
[root@localhost ~]# yum install bind httpd -y
2. Configure DNS master configuration file
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { any; }; //将127.0.0.1替换成any
...... //省略部分内容
allow-query { any; }; //将ocalhost替换成any
3. Configure DNS zone configuration file
[root@localhost ~]# vim /etc/named.rfc1912.zones
zone "bdqn.com" IN { type master;
file "bdqn.com.zone";
allow-update { none; };
};
4. DNS zone configuration data configuration file, and start the service
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -p named.localhost bdqn.com.zone
[root@localhost named]# vim bdqn.com.zone
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
www IN A 192.168.235.149
//A记录地址为本机IP地址
[root@localhost named]# systemctl start named
5. Modify the Apache service master configuration file, and open service
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
...
41 Listen 192.168.235.149:80
//在文件的41行添加监听地址为本主机IP地址
42 #Listen 80
//注释掉第46 行IPV6的监听
...
95 ServerName www.bdqn.com:80
//在第95行修改域名地址
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl start httpd
6. Use win7 client testing
Step Two: Sharing and install Awstar Kit
[root@localhost aaa]# mkdir /aaa
[root@localhost ~]# mount.cifs //192.168.10.37/LAMP /aaa
Password for root@//192.168.10.37/LAMP:
//远程挂载Windows宿主机上的共享包
[root@localhost aaa]# cd /aaa
[root@localhost aaa]# tar zxvf awstats-7.6.tar.gz -C /opt/
//将工具包解压到/opt目录
[root@localhost aaa]# ls /opt
awstats-7.6 rh
[root@localhost aaa]# cd /opt
[root@localhost opt]# mv awstats-7.6/ /usr/local/awstat
//移动工具包到
[root@localhost opt]# ls /usr/local/ //查看命令中是否有awstat文件
awstat etc include lib64 sbin src
bin games lib libexec share
[root@localhost opt]# ls /usr/local/awstat/tools/ //查看此命令中是否有awstats_configure.pl 文件
awstats_buildstaticpages.pl logresolvemerge.pl
awstats_configure.pl maillogconvert.pl
awstats_exportlib.pl nginx
awstats_updateall.pl urlaliasbuilder.pl
dolibarr webmin
geoip_generator.pl xslt
httpd_conf
[root@localhost opt]# cd /usr/local/awstat/tools/ //进入目录
[root@localhost tools]# ./awstats_configure.pl
//运行文件
...
Do you want to continue setup from this NON standard directory [yN] ? y
//在此步骤输入y进行确认
...
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf
//在此步骤输入Apache服务的路径
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y
//此步骤输入y确认
...
Your web site, virtual server or profile name:
> www.bdqn.com
//在此步骤输入网站的域名
...
//以下步骤均按回车键即可
The third step: Modify the Apache configuration file
[root@localhost tools]# vim /etc/httpd/conf/httpd.conf
...
366 <Directory "/usr/local/awstat/wwwroot">
367 Options None
368 AllowOverride None
369 Order allow,deny
370 Allow from all
371 Require all granted //在第371行插入此行条目用以允许所有访问
372 </Directory>
Step Four: Modify the created file awstart
[root@localhost tools]# ls /etc/awstats/
awstats.www.bdqn.com.conf
[root@localhost tools]# vim /etc/awstats/awstats.www.bdqn.com.conf
50 LogFile="/var/log/httpd/access_log"
//修改第50行的行尾内容为access_log
Step 5: Create awstats folder and restart the service
[root@localhost tools]# cd /var/lib/
[root@localhost lib]# mkdir awstats
[root@localhost lib]# systemctl stop httpd
[root@localhost lib]# systemctl start httpd
Step 6: Using client test
Enter http://www.bdqn.com/awstats/awstats.pl?config=www.bdqn.com in a browser
can access log analysis system statistics page
however address the site is too complex, we can optimize it
[root@localhost tools]# cd /var/www/html/ //进入站点目录
[root@localhost html]# vim aws.html //创建aws.html网页,并将原本服战的网页链接放入即可
<html>
<head> <meta http-equiv=refresh content="0;url=http://www.bdqn.com/awstats/awstats.pl?config=www.bdqn.com">
</head>
<body></body>
</html>
[root@localhost html]# ls
aws.html
In this way, we only need access to associated www.bdqn.com/AWS.html access to the statistics page