AWStats日志分析

AWStats日志分析AWStats日志分析系统介绍1.AWStats日志分析系统(1)Peri语言开发的一款开源日志分析系统(2)可用来分析Apache、Samba、Vsftpd、IIS等服务器的访问日志(3)信息结合crond等计划任务服务,可对日志内容定期进行分析部署AWStats日志分析系统1.安装AWStats软件包2.为要统计的站点建立配置文件3.修改站点统计配置文件…

大家好,又见面了,我是你们的朋友全栈君。

AWStats日志分析系统介绍

1.AWStats日志分析系统

(1)Peri语言开发的一款开源日志分析系统

(2)可用来分析Apache、Samba、 Vsftpd、 IIS等服务 器的访问日志

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

部署AWStats日志分析系统

1.安装AWStats软件包

2.为要统计的站点建立配置文件

3.修改站点统计配置文件

4.执行日志分析,并设置crontab计划任务

访问AWStats分析系统

1.查看统计页面

2.设置网页自动跳转,方便访问

具体操作:

1.安装DNS和HTTP服务软件包

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

2.DNS配置

(1)主配置文件

[root@localhost ~]# vim /etc/named.conf 

AWStats日志分析
(2)区域配置文件

[root@localhost ~]# vim /etc/named.rfc1912.zones 

AWStats日志分析

(3)区域数据配置文件

[root@localhost ~]# cd /var/named/
[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 

AWStats日志分析

(4)开启DNS服务

[root@localhost named]# systemctl start named

3.HTTP配置

(1)配置文件

[root@localhost named]# vim /etc/httpd/conf/httpd.conf

AWStats日志分析

AWStats日志分析

(2)关闭防火墙,开启服务

[root@localhost named]# systemctl stop firewalld.service 
[root@localhost named]# setenforce 0
[root@localhost named]# systemctl start httpd

4.Windows 10配置

(1)在win10主机上更改下DNS地址

AWStats日志分析

(2)在浏览器上访问域名,保证能够进行对Apache访问

AWStats日志分析

5.此时可以查看下日志文件,可以看出是来自IP地址为多少的主机来进行的访问

[root@localhost ~]# cd /var/log/httpd/
[root@localhost httpd]# cat access_log 
192.168.124.131 - - [23/Oct/2019:22:23:33 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:33 +0800] "GET / HTTP/1.1" 403 4897 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:33 +0800] "GET /noindex/css/bootstrap.min.css HTTP/1.1" 200 19341 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:33 +0800] "GET /noindex/css/open-sans.css HTTP/1.1" 200 5081 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
192.168.124.131 - - [23/Oct/2019:22:23:33 +0800] "GET /images/poweredby.png HTTP/1.1" 200 3956 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:33 +0800] "GET /images/apache_pb.gif HTTP/1.1" 200 2326 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Light/OpenSans-Light.woff HTTP/1.1" 404 241 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Regular/OpenSans-Regular.woff HTTP/1.1" 404 245 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/LightItalic/OpenSans-LightItalic.woff HTTP/1.1" 404 253 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Italic/OpenSans-Italic.woff HTTP/1.1" 404 243 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Semibold/OpenSans-Semibold.woff HTTP/1.1" 404 247 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/SemiboldItalic/OpenSans-SemiboldItalic.woff HTTP/1.1" 404 259 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Bold/OpenSans-Bold.woff HTTP/1.1" 404 239 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/ExtraBold/OpenSans-ExtraBold.woff HTTP/1.1" 404 249 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.woff HTTP/1.1" 404 261 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Light/OpenSans-Light.ttf HTTP/1.1" 404 240 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/LightItalic/OpenSans-LightItalic.ttf HTTP/1.1" 404 252 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Regular/OpenSans-Regular.ttf HTTP/1.1" 404 244 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Italic/OpenSans-Italic.ttf HTTP/1.1" 404 242 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Semibold/OpenSans-Semibold.ttf HTTP/1.1" 404 246 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/SemiboldItalic/OpenSans-SemiboldItalic.ttf HTTP/1.1" 404 258 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/Bold/OpenSans-Bold.ttf HTTP/1.1" 404 238 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/ExtraBold/OpenSans-ExtraBold.ttf HTTP/1.1" 404 248 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/ExtraBoldItalic/OpenSans-ExtraBoldItalic.ttf HTTP/1.1" 404 260 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/BoldItalic/OpenSans-BoldItalic.woff HTTP/1.1" 404 251 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.131 - - [23/Oct/2019:22:23:34 +0800] "GET /noindex/css/fonts/BoldItalic/OpenSans-BoldItalic.ttf HTTP/1.1" 404 250 "http://www.kgc.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"
192.168.124.129 - - [23/Oct/2019:22:23:41 +0800] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.4.6 (CentOS) (internal dummy connection)"
192.168.124.129 - - [23/Oct/2019:22:23:42 +0800] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.4.6 (CentOS) (internal dummy connection)"

6.远程共享并挂载

[root@localhost ~]# smbclient -L //192.168.100.7/
Enter SAMBA\root's password: 
OS=[Windows 10 Home China 18362] Server=[Windows 10 Home China 6.3]

	Sharename       Type      Comment
	---------       ----      -------
	ADMIN$          Disk      远程管理
	C$              Disk      默认共享
	D$              Disk      默认共享
	IPC$            IPC       远程 IPC
	LAMP-C7         Disk      
	Users           Disk      
	脚本          Disk      
Connection to 192.168.100.7 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available
[root@localhost ~]# mount.cifs //192.168.100.7/LAMP-C7 /abc/
Password for root@//192.168.100.7/LAMP-C7:  
[root@localhost ~]# cd /abc/
[root@localhost abc]# ls
apr-1.6.2.tar.gz       cronolog-1.6.2-14.el7.x86_64.rpm  LAMP-php5.6.txt
apr-util-1.6.0.tar.gz  Discuz_X2.5_SC_UTF8.zip           mysql-5.6.26.tar.gz
awstats-7.6.tar.gz     httpd-2.4.29.tar.bz2              php-5.6.11.tar.bz2
[root@localhost abc]# 

7.解压缩包并移动安装包存放位置

[root@localhost abc]# tar zxvf awstats-7.6.tar.gz -C /opt/
[root@localhost abc]# cd /opt/
[root@localhost opt]# mv awstats-7.6/ /usr/local/awstats
[root@localhost opt]# cd /usr/local/
[root@localhost local]# ls
awstats  bin  etc  games  include  lib  lib64  libexec  sbin  share  src
[root@localhost local]# cd awstats/
[root@localhost awstats]# ls
docs  README.md  tools  wwwroot
[root@localhost awstats]# cd tools/
[root@localhost tools]# ls
awstats_buildstaticpages.pl  dolibarr            maillogconvert.pl   xslt
awstats_configure.pl         geoip_generator.pl  nginx
awstats_exportlib.pl         httpd_conf          urlaliasbuilder.pl
awstats_updateall.pl         logresolvemerge.pl  webmin

8.更新数据

[root@localhost tools]# ./awstats_configure.pl 

> /etc/httpd/conf/httpd.conf
> file (required if first install) [y/N] ? y
> www.kgc.com

9.HTTP配置文件

[root@localhost tools]# cd /etc/httpd/conf
[root@localhost conf]# vim httpd.conf 

AWStats日志分析

10.进入awstats.www.kgc.com.conf配置文件

[root@localhost conf]# cd /etc/awstats/
[root@localhost awstats]# ls
awstats.www.kgc.com.conf
[root@localhost awstats]# vim awstats.www.kgc.com.conf

AWStats日志分析

DirData=”/var/lib/awstats”                               //awstats默认不存在(需要创建)

[root@localhost awstats]# cd /var/lib/
[root@localhost lib]# ls           查看没有awstats
创建后在查看
[root@localhost lib]# mkdir awstats

9.重启HTTP服务,在Windows10上进行访问

[root@localhost lib]# systemctl restart httpd

搜索:http://localhost/awstats/awstats.pl?config=www.kgc.com,会发现数值都是0,并且没有柱状图

AWStats日志分析

10.更新数据

[root@localhost lib]# cd /usr/local/awstats/
[root@localhost awstats]# ls
docs  README.md  tools  wwwroot
[root@localhost awstats]# cd tools/
[root@localhost tools]# ls
awstats_buildstaticpages.pl  dolibarr            maillogconvert.pl   xslt
awstats_configure.pl         geoip_generator.pl  nginx
awstats_exportlib.pl         httpd_conf          urlaliasbuilder.pl
awstats_updateall.pl         logresolvemerge.pl  webmin
[root@localhost tools]# ./awstats_updateall.pl now           //更新数据

11.计划性任务更新数据,并启动

[root@localhost tools]# crontab -e
*/5 * * * *     /usr/local/awstats/tools/awstats_updateall.pl now

[root@localhost tools]# systemctl start crond

12.再去Windows10中进行访问,会有柱状图显示

AWStats日志分析

13.优化网络地址,方便记忆

[root@localhost tools]# cd /var/www/html/
[root@localhost html]# ls
[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>

14.在浏览器输入:
http://www.kgc.com/aws.html

AWStats日志分析

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/160203.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • TensorFlow学习--学习率衰减/learning rate decay

    TensorFlow学习--学习率衰减/learning rate decay学习率衰减学习率衰减(learningratedecay)在训练神经网络时,使用学习率控制参数的更新速度.学习率较小时,会大大降低参数的更新速度;学习率较大时,会使搜索过程中发生震荡,导致参数在极优值附近徘徊.为此,在训练过程中引入学习率衰减,使学习率随着训练的进行逐渐衰减.TensorFlow中实现的学习率衰减方法:tf.train.piecewise_constant…

  • 概率论中的PDF,PMF,CDF区别和联系

    概率论中的PDF,PMF,CDF区别和联系1. PDF:概率密度函数(probabilitydensityfunction),在数学中,连续型随机变量的概率密度函数(在不至于混淆时可以简称为密度函数)是一个描述这个随机变量的输出值,在某个确定的取值点附近的可能性的函数。本身不是概率,取值积分后才是概率。2. PMF:概率质量函数(probabilitymassfunction),在概率论中,概率质量函数

  • c++中this指针的用法详解

    c++中this指针的用法详解为什么引入this指针?   最简单的应用场景就是:当我们在类中定义了一个变量,同时在类成员函数中定义了同一变量时,也就是说变量名重复时,但是我们想使用类中定义的变量,这个时候我们该怎么办呢?这个时候就是this指针大显身手的时候了。为此我们引入this指针的概念。1.this指针的用处:  一个对象的this指针并不是对象本身的一部分,不会影响sizeof(对象)的结果。this…

  • JAVA静态内部类_java静态内部类实例化

    JAVA静态内部类_java静态内部类实例化写在前面  不知不觉,我正式入职到部门实习也有一周多的时间了,这段时间确实学到了不少东西。从大公司的办公、办事的流程准则,到程序员的日常研发工作和其中的注意事项,导师和同事们都很乐于帮助我融入这个新环境。  因为实习生不用加班,业余时间也比较多。便想着利用空闲时间来深入学习、总结一些平时工作中遇到的知识点和代码细节,把之前因为准备期末都快要荒废掉的写博客总结的习惯重新拾回来。fighting~!

    2022年10月10日
  • CSS3-transition「建议收藏」

    CSS3-transition「建议收藏」1、transition代表css3中的过渡,可以使元素从一种样式逐渐改变为另一种的效果。2、transition:height2s;表示需要渐变的是元素高度height,渐变时间是2s。tra

  • java -jar没有主清单属性_idea怎么导入jar

    java -jar没有主清单属性_idea怎么导入jar使用idea2018打包了一个springboot项目(打包为jar)启动是报错如下:错误原因打包后的jar文件中的MANIFEST.MF缺少项目启动项,即没有Main-Class和Start-Class如下:解决方案如下指定MANIFEST.MF路径项目打包前第一步file–&gt;projectstructure弹框后选中Atifacts—&gt…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号