文章目录

  • 一、AWStats日志分析系统简介
  • 二、部署AWStats日志分析系统

一、AWStats日志分析系统简介

  • Perl语言开发的一款开源日志分析系统
  • 可用来分析Apache、Samba、Vsftpd、IIS等服务器的访问日志
  • 结合crond等计划任务服务,可对日志内容定期进行分析

二、部署AWStats日志分析系统

  • 实验环境:VMware Workstation 15.5、Centos7.6、Xshell 6、Windows10专业工作站版

  • 实验准备:新建两台虚拟机,一台为Centos7.6系统,作为DNS和http服务器(IP:192.168.50.136);另一台为windows10系统,作为客户机(IP:192.168.50.140),在客户机上进行如下设置:

  • 实验步骤:

1、关闭系统系统核心防护并清空防火墙规则

[root@localhost ~]# setenforce 0
[root@localhost ~]# iptables -F

2、安装DNS与http服务

[root@localhost ~]# yum -y install bind httpd

3、修改DNS主配置文件

[root@localhost ~]# vi /etc/named.conf 将红框标记的两处127.0.0.1改为any


4、修改DNS区域配置文件

[root@localhost ~]# vi /etc/named.rfc1912.zones对照行号修改配置文件如下两处:zone "test.com" IN {type master;file "test.com.zome";allow-update { none; };
};


5、复制区域数据配置文件模板并改名为刚才设置的test.zom.zone

[root@localhost named]# cp -p named.localhost test.com.zome

6、编辑DNS区域数据配置文件

[root@localhost named]# vi test.com.zome    ## 编辑配置文件修改最后一行内容为:
www IN  A       192.168.50.136


7、启动DNS服务

[root@localhost named]# systemctl start named

8、使用客户机进行域名解析


9、修改http服务主配置文件

[root@localhost named]# vim /etc/httpd/conf/httpd.conf    ## 修改配置文件将41、42行的监听地址修改为:
Listen 192.168.50.136:80
#Listen 80将95行的域名修改为:
ServerName www.test.com:80


10、在http服务站点目录下创建一个页面

[root@localhost named]# vi /var/www/html/index.html   ## 新建网页文件写入如下内容:
<h1>This is a test Web!</h1>

11、启动http服务

[root@localhost named]# systemctl start httpd

12、在客户机上打打开浏览器,访问www.test.com

下面进行安装AWStats

13、首先将源码包上传到服务器/opt目录下

[root@localhost named]# cd /opt     ## 进入opt目录
上传源码包    ## 有多种方式,Xshell6支持拖拽上传,如果使用putty等客户端可以使用XFTP工具连接服务器后进行上传

14、解压缩源码包

[root@localhost opt]# tar zxvf awstats-7.6.tar.gz

15、将解压后的目录移动到安装目录中并新建一个awstats目录

[root@localhost opt]# mv awstats-7.6 /usr/local/awstats

16、进入awstats目录,进行软件配置

[root@localhost opt]# cd /usr/local/awstats/tools     ## 进入软件目录[root@localhost 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 installEnter 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服务主配置文件路径-----> 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>' directiveAWStats 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         ## 输入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.test.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.test.com.conf'Config file /etc/awstats/awstats.www.test.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.test.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.test.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.test.com' with command:
> perl awstats.pl -update -config=www.test.com
You can also read your statistics for 'www.test.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.test.com     ## 软件后台地址Press ENTER to finish...        ## 直接回车,结束配置

17、修改http服务配置文件

[root@localhost tools]# vi /etc/httpd/conf/httpd.conf 将371与372行注释掉,并在下方添加一行内容:#Order allow,deny
#Allow from all
Require all granted

18、编辑awstats服务生成的配置文件

[root@localhost awstats]# vi /etc/awstats/awstats.www.test.com.conf 修改如下内容:
修改第50行内容:LogFile="/var/log/httpd/access_log"找到220行,有如下内容:
DirData="/var/lib/awstats"但在/var/lib/目录下并找不到awstats这个目录,所以我们要手动创建一个
[root@localhost awstats]# mkdir /var/lib/awstats

19、重启http服务

[root@localhost awstats]# systemctl restart httpd

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

http://www.test.com/awstats/awstats.pl?config=www.test.com注意:链接原本中写的是localhost,需要将其改为自己的域名

21、为了方便管理,我们可以将脚本添加进计划任务,每5分钟执行一次更新数据

[root@localhost awstats]# crontab -e     ## 编辑周期性计划任务写入如下内容:
*/5 * * * * /usr/local/awstats/tools/awststs_updateall.pl now

22、进入客户机访问www.test.com站点,并多刷新几次

进入awstats软件目录,执行脚本刷新访问数据

[root@localhost awstats]# cd /usr/local/awstats/tools/     ## 进入目录
[root@localhost tools]# ./awstats_updateall.pl now   ## 更新数据

23、再次访问后台统计页面,发现访问数据已经刷新了

Centos7.6下搭建AWStats日志分析系统相关推荐

  1. 搭建AWStats日志分析系统

    文章目录 搭建AWStats日志分析系统 实验步骤: 修改DNS主配置文件 修改http服务主配置文件 安装AWStats 修改http服务配置文件 搭建AWStats日志分析系统 AWStats是一 ...

  2. AWStats日志分析系统

    文章目录 一.概述 二.实验环境 三.实验步骤 四.安装配置apache 五.安装配置DNS 六.安装AWStats 七.实验测试 搭建服务所需安装包和工具包 链接:https://pan.baidu ...

  3. AWStats 日志分析系统(含源码包)

    前言 在上一篇文章中写了关于httpd的一些简介.配置.那么我们应该知道,HTTP服务器的访问量非常庞大,在它的访问日志文件access_log 中,记录了很多很多客户的访问信息,维护的管理人员会通过 ...

  4. awstats linux日志分析,Linux环境下安装部署AWStats日志分析系统实例

    AWStats是使用Perl语言开发的一款开放性日志分析系统,可分析Apache网站服务器的访问日志,还可以用来分析Samba.Vsftpd.IIS等日志信息. 此文章主要讲解如何在linux系统下安 ...

  5. Linux环境下安装部署AWStats日志分析系统实例

    AWStats是使用Perl语言开发的一款开放性日志分析系统,可分析Apache网站服务器的访问日志,还可以用来分析Samba.Vsftpd.IIS等日志信息.       此文章主要讲解如何在lin ...

  6. 部署Awstats日志分析系统

    AWStats分析系统是使用Perl语言开发的一款开源日志分析系统.可用于分析Apache.Samba.Vsftpd.IIS等服务的日志信息.也可以结合crond等计划任务,不断对增长的日志进行定期分 ...

  7. linux 分析系统配置,在Linux系统上部署AWStats日志分析系统

    AWStats是使用Perl语言开发的一款开源日志分析系统,它不仅可用来分析Apache网站服务器的访问日志,也可用来分析Samba Vsftpd IIS等服务的日志信息.综合crond等计划任务服务 ...

  8. 搭建ELK日志分析系统详解

    日志分析是运维工程师解决系统故障.发现问题的主要手段.日志包含多种类型,包括程序日志.系统日志以及安全日志等.通过对日志的分析,既可以做到未雨绸缪.预防故障的发生,又可以在故障发生时,寻找蛛丝马迹.快 ...

  9. 在Windows系统下搭建ELK日志分析平台

    2018年07月11日 22:29:45 民国周先生 阅读数:35 再记录一下elk的搭建,个人觉得挺麻烦的,建议还是在linux系统下搭建,性能会好一些,但我是在windows下搭建的,还是记录一下 ...

最新文章

  1. Linear and Discrete Optimization - Week 1
  2. Linux磁盘扇区和内存页,技术|检查linux中硬盘损坏的扇区和区块
  3. linux跨服务器复制文件夹,linux下跨服务器文件文件夹的复制
  4. 树莓派3B 安装中文输入法谷歌输入法途中碰到的各种问题
  5. 3.1 cat:合并文件或查看文件内容
  6. 【Linux】一步一步学Linux——nstat命令(190)
  7. windows server 2012 RC download.
  8. 为什么仿宋字体打印出楷体_win7缺少仿宋_GB2312和楷体_GB2312字体,造成word字体显示不正常...
  9. 查询各种物流运输信息
  10. 配置Log4j(很详细)1
  11. STM32寄存器操作端口模式SDA_OUT()/SDA_IN()
  12. React(2)之——React组件化
  13. [Internet]使用IP安全策略阻止Ping
  14. 【广东大学生网络攻防大赛-WriteUp(非官方)】Web | in
  15. Unity精华☀️Audio Mixer终极教程:用《双人成行》讲解它的用途
  16. 【Java 8 新特性】Java CompletableFuture thenApply()
  17. 备份服务器c盘系统还原,win7 64位专业版系统下备份和还原C盘的方法
  18. 今天公司HR推荐了一个人来应聘财务经理
  19. Unity Profiler
  20. 仅 300 员工却垄断全球,几亿一台还供不应求……

热门文章

  1. Android图库/相册,禁止扫描指定的图片目录
  2. MongoDB技术实践与应用案例征集中
  3. java ftp上传文件0字节_FTP上传无文件以及0字节问题
  4. 逐次超松弛迭代法 ( SOR ) 的C++实现
  5. 【经验总结】10年的嵌入式开发老手,到底是如何快速学习和使用RT-Thread的?(文末赠书5本)
  6. 三十六、服务定位器模式 (Service Locator Pattern)
  7. 前端初级新人,如何撕去菜鸟标签
  8. 小工具:屏幕按键实时演示
  9. 基于eclipse的android项目实战—博学谷(十三)水平滑动广告栏界面
  10. Nokia 手机开发官方资料索引