Linux---Awstats日志分析

Linux—Awstats日志分析

一.AWStats日志分析系统

1.Perl语言开发的一款开源日志分析系统

2.可用来分析Apache,Samba,Vsftpd,IIS等服务器的访问日志

3.信息结合crond等计划任务服务,可对日志内容定期进行分析

二.Awstats日志分析实验

1.安装服务
[root@localhost ~]# yum install bind httpd -y
2.配置DNS
主配置文件:
[root@localhost ~]# vim /etc/named.conf 

在这里插入图片描述

区域配置文件:
[root@localhost ~]# vim /etc/named.rfc1912.zones 

在这里插入图片描述

区域数据配置文件:
[root@localhost named]# ls
data  dynamic  named.ca  named.empty  named.localhost  named.loopback  slaves
[root@localhost named]# cp -p named.localhost kgc.com.zone
[root@localhost named]# vim kgc.com.zone 

在这里插入图片描述

开启服务:
[root@localhost named]# systemctl start named
3.配置Ahache:
配置文件:
[root@localhost named]# vim /etc/httpd/conf/httpd.conf 

在这里插入图片描述

在这里插入图片描述

关防火墙,开服务:
[root@localhost named]# systemctl stop firewalld.service 
[root@localhost named]# setenforce 0
[root@localhost named]# systemctl start httpd
4.解析,并访问:
[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# setenforce 0
[root@localhost ~]# vim /etc/resolv.conf 
[root@localhost ~]# 

在这里插入图片描述

在这里插入图片描述

5.准备安装包,并解压:
[root@localhost ~]# rz

[root@localhost ~]# ls
anaconda-ks.cfg     initial-setup-ks.cfg  模板  图片  下载  桌面
awstats-7.6.tar.gz  公共                  视频  文档  音乐
[root@localhost ~]# tar zxvf awstats-7.6.tar.gz -C /opt/
6.把包移到/usr/local下,并重命名:
[root@localhost ~]# mv /opt/awstats-7.6 /usr/local/awstats
7.用脚本配置Apache文件:
[root@localhost opt]# cd /usr/local/awstats/tools
[root@localhost tools]# ls
awstats_buildstaticpages.pl  awstats_updateall.pl  httpd_conf          nginx               xslt
awstats_configure.pl         dolibarr              logresolvemerge.pl  urlaliasbuilder.pl
awstats_exportlib.pl         geoip_generator.pl    maillogconvert.pl   webmin
[root@localhost tools]# ./awstats_configure.pl

在这里插入图片描述

在这里插入图片描述

配置Apache:
[root@localhost tools]# vim /etc/httpd/conf/httpd.conf

在这里插入图片描述

[root@localhost tools]# vim /etc/awstats/awstats.www.kgc.com.conf
[root@localhost tools]# mkdir /var/lib/awstats
修改访问日志文件位置:
LogFile="/var/log/httpd/access_log"

DirData="/var/lib/awstats"
8.重启服务并查看
[root@localhost tools]# systemctl restart httpd.service 

在这里插入图片描述

9.更新数据,并查看:
[root@localhost 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...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 12
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 12 new qualified records.

在这里插入图片描述

10.计划性任务更新数据
[root@localhost tools]# crontab -e
no crontab for root - using an empty one
crontab: installing new crontab

*/5 * * * *  /usr/local/awstats/tools/awstats_updateall.pl now
11.优化网页地址:
[root@localhost tools]# cd /var/www/html/
[root@localhost 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>
12.用直接用www.kgc.com/aws.html访问

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值