欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

搭建AWStats日志分析系统

程序员文章站 2022-06-25 20:25:56
...

搭建AWStats日志分析系统

AWStats是一款功能强大且功能强大的免费工具,可以图形方式生成高级Web,流媒体,ftp或邮件服务器统计信息。此日志分析器用作CGI或命令行, 并在几个图形网页中显示您的日志包含的所有可能信息。
它使用部分信息文件来经常快速地处理大型日志文件。它可以分析来自所有主要服务器工具的日志文件,如Apache日志文件(NCSA组合/ XLF / ELF日志格式或通用/ CLF日志格式),WebStar,IIS(W3C日志格式)以及许多其他Web,代理,wap,流服务器,邮件服务器和一些ftp服务器。

实验步骤:

修改DNS主配置文件

[aaa@qq.com ~]# yum -y install httpd bind
[aaa@qq.com ~]# vim /etc/named.conf 
[aaa@qq.com ~]# vi /etc/named.rfc1912.zones

zone "test.com" IN {
        type master;
        file "test.com.zome";
        allow-update { none; };
};

[aaa@qq.com ~]# vim /etc/named.rfc1912.zones 
zone "test.com" IN {
        type master;
        file "test.com.zome";
        allow-update { none; };

[aaa@qq.com ~]# cp -p named.localhost kgc.com.zone
[aaa@qq.com ~]# vim kgc.com.zone
[aaa@qq.com named]# vi test.com.zome    ## 编辑配置文件
修改最后一行内容为:
www IN  A       192.168.136.123

[aaa@qq.com ~]# systemctl restart named

修改http服务主配置文件

[aaa@qq.com named]# vim /etc/httpd/conf/httpd.conf    ## 修改配置文件
   
Listen 192.168.50.136:80
#Listen 80

ServerName www.test.com:80
[aaa@qq.com named]# vi /var/www/html/index.html   ## 新建网页文件

<h1>This is ko03</h1>

搭建AWStats日志分析系统

安装AWStats

[aaa@qq.com named]# cd /opt 
[aaa@qq.com opt]# tar zxvf awstats-7.6.tar.gz

[aaa@qq.com opt]#mv awstats-7.6 /usr/local/awstats   安装并移动软件
[aaa@qq.com opt]# cd /usr/local/awstats/tools/
[aaa@qq.com tools]# ./awstats_updateall.pl now
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  输入http服务主配置文件路径
-----> 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           输入域名



修改http服务配置文件

[aaa@qq.com tools]# vi /etc/httpd/conf/httpd.conf
<Directory "/usr/local/awstats/wwwroot">
    Options None
    AllowOverride None
#    Order allow,deny     注释掉
#    Allow from all        注释掉
    Require all granted           
</Directory>
[aaa@qq.com tools]# cd /etc/awstats/
[aaa@qq.com awstats]# vim awstats.www.kgc.com.conf 
LogFile="/var/log/httpd/access_log"   修改
[aaa@qq.com lib]# mkdir awstats  创建一个目录
[aaa@qq.com lib]# systemctl restart httpd.service 
  www.kgc.com/awstats/awstats.pl?config=www.kgc.com   访问网站

在客户机中打开浏览器,访问统计后台地址

搭建AWStats日志分析系统

搭建AWStats日志分析系统

刷新


添加进计划任务

[aaa@qq.com awstats]# crontab -e     ## 编辑周期性计划任务

写入如下内容:
*/5 * * * * /usr/local/awstats/tools/awststs_updateall.pl now
[aaa@qq.com awstats]# cd /usr/local/awstats/tools/     **进入目录
[aaa@qq.com tools]# ./awstats_updateall.pl now   更新数据
Running '"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=www.kgc.com -configdir="/etc/awstats"' to update config www.kgc.com
Create/Update database for config "/etc/awstats/awstats.www.kgc.com.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 98)
Jumped lines in file: 98
 Found 98 already parsed records.
Parsed lines in file: 0
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 0 new qualified records.

rds,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.




![image-20200806132354567](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9naXRlZS5jb20vemhhbmd4dWUxMjMxMjMvZGFpbWF0dXBpYW4vcmF3L21hc3Rlci9pbWcvaW1hZ2UtMjAyMDA4MDYxMzIzNTQ1NjcucG5n?x-oss-process=image/format,png)
相关标签: 日志