centos 7.6 ——AWstate 日志分析工具
(1)配置DNS服务
drwxr-xr-x. 2 root root 6 10月 31 2018 rh
[root@promote opt]# iptables -F
[root@promote opt]# setenforce 0
[root@promote opt]# yum -y install httpd bind
[root@promote opt]#vim /etc/named.conf
listen-on port 53 { any; };
allow-query { any; };
[root@promote opt]#vim /etc/named.rfc1912.zones
zone "kgc.com" IN {
type master;
file "kgc.com.zone";
allow-update { none; };
[root@promote opt]#cd /var/named/
[root@promote named]# cp -p named.localhost kgc.com.zone
[root@promote named]# vim kgc.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.75.134
[root@promote named]#systemctl restart httpd
[root@promote named]# systemctl restart named
虚拟机win10 验证
(3) 安装AWstat
[root@promote named]# cd /opt
[root@promote opt]# rz -E
rz waiting to receive.
[root@promote opt]# ll
总用量 2888
-rw-r--r--. 1 root root 2955876 8月 5 14:48 awstats-7.6.tar.gz
drwxr-xr-x. 2 root root 6 10月 31 2018 rh
[root@promote opt]# tar zxvf awstats-7.6.tar.gz
[root@promote opt]# ll
总用量 2888
drwxr-xr-x. 5 ttyy ttyy 63 12月 3 2016 awstats-7.6
-rw-r--r--. 1 root root 2955876 8月 5 14:48 awstats-7.6.tar.gz
drwxr-xr-x. 2 root root 6 10月 31 2018 rh
[root@promote opt]#
[root@promote opt]# mv awstats-7.6 /usr/local/awstats
[root@promote opt]# cd /usr/local/
[root@promote awstats]# ll
总用量 16
drwxr-xr-x. 4 ttyy ttyy 4096 12月 3 2016 docs
-rw-r--r--. 1 ttyy ttyy 7250 9月 11 2016 README.md
drwxr-xr-x. 6 ttyy ttyy 4096 8月 28 2016 tools
drwxr-xr-x. 7 ttyy ttyy 69 11月 4 2013 wwwroot
[root@promote awstats]# cd tools/
[root@promote tools]# ./awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 20140126) (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):
> /etc/httpd/conf/httpd.conf //输入数据存放的路径
-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
Add '<Directory>' directive
AWStats directives added to Apache config file.
-----> 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:
> www.kgc.com //输入域名
-----> 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):
>
-----> Create config file '/etc/awstats/awstats.www.kgc.com.conf'
Config file /etc/awstats/awstats.www.kgc.com.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
Redirecting to /bin/systemctl restart httpd.service
-----> 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=www.kgc.com
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: /etc/awstats/awstats.www.kgc.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.kgc.com' with command:
> perl awstats.pl -update -config=www.kgc.com
You can also read your statistics for 'www.kgc.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.kgc.com //AWstats日志解析工具的域名
Press ENTER to finish...
[root@promote tools]# vim /etc/httpd/conf/httpd.conf
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
#Order allow,deny //注释
#Allow from all //注释
Require all granted //添加权限
</Directory>
[root@promote tools]# cd /etc/awstats/
[root@promote awstats]# ll
总用量 64
-rw-r--r--. 1 root root 63599 8月 5 18:51 awstats.www.kgc.com.conf
[root@promote awstats]# vim awstats.www.kgc.com.conf
LogFile="/var/log/httpd/access_log"
DirData="/var/lib/awstats" //在这个目录下新建awstats目录
[root@promote awstats]#cd /var/lib
[root@promote lib]# mkdir awstats
[root@promote awstats]# systemctl restart httpd
(3)虚拟机win 10 验证
http://www.kgc.com/awstats/awstats.pl?config=www.kgc.com
新建另一网页访问网页然后查看awstats 日志分析工具
[root@promote tools]# pwd
/usr/local/awstats/tools
[root@promote tools]# ./awstats_updateall.pl now //刷新日志信息
[root@promote tools]# crontab -e //设置任务计划每5个小时,进行一次更新数据
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
(4)优化域名
[root@promote html]# pwd
/var/www/html
[root@promote html]# vim aws.html
<html>
<head>
<meta http-equiv=refresh content="0;url=http://www.kgc.com/awstats/awstats.pl?config=www.kgc.com">
</head>
<body></body>
</html>
~
[root@promote html]#systemctl restart httpd
(4)win 10 验证
www.kgc.com/aws.html