Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >AWStats日志分析系统

AWStats日志分析系统

作者头像
惨绿少年
发布于 2018-12-12 08:10:51
发布于 2018-12-12 08:10:51
1.6K00
代码可运行
举报
文章被收录于专栏:惨绿少年惨绿少年
运行总次数:0
代码可运行

1.什么是AWStats

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

2.安装AWStats

2.1 获取awstats

AWStats 官网:https://awstats.sourceforge.io/ AWStats 下载地址: https://awstats.sourceforge.io/#DOWNLOAD

2.2安装awstats

系统版本说明

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@clsn ~]# cat  /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@clsn ~]# uname  -r
3.10.0-862.9.1.el7.x86_64

安装步骤

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
wget https://prdownloads.sourceforge.net/awstats/awstats-7.7.tar.gz
tar  xf awstats-7.7.tar.gz 
mv  awstats-7.7 /usr/local/
ln -s /usr/local/awstats-7.7/ /usr/local/awstats
# 注:awstats默认为www用户,可以根据web环境用户进行修改
chown -R www.www /usr/local/awstats/

3.配置启动AWStats

3.1初始化配置

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
在这次配置中我已站点nmtui.com为例,进行设置。
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@clsn tools]# cd /usr/local/awstats/tools
[root@clsn 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
Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'.
If you want to use standard directory, you should first move all content
of AWStats distribution from current directory:
/usr/local/awstats-7.7
to standard directory:
/usr/local/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ? y

-----> 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): #
> none

Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)

-----> Update model config file '/usr/local/awstats-7.7/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:
> nmtui.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.nmtui.com.conf'
 Config file /etc/awstats/awstats.nmtui.com.conf created.

-----> 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-7.7/wwwroot/cgi-bin/awstats.pl -update -config=nmtui.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats-7.7/tools/awstats_updateall.pl now
Press ENTER to continue...


A SIMPLE config file has been created: /etc/awstats/awstats.nmtui.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'nmtui.com' with command:
> perl awstats.pl -update -config=nmtui.com
You can also build static report pages for 'nmtui.com' with command:
> perl awstats.pl -output=pagetype -config=nmtui.com

Press ENTER to finish...

3.2编辑配置文件

在初始化配置红 nmtui.com 站点的配置文件在 /etc/awstats/awstats.nmtui.com.conf

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
vi /etc/awstats/awstats.nmtui.com.conf
# 在配置中寻找【 LogFile 】字段,将其修改为该主机的日志地址。
LogFile="/www/wwwlogs/nmtui.com.log"

3.3配置web站点展示awstats

在使用之前需要搭建nginx或httpd等web服务,可以参考:http://clsn.io/clsn/lx892.html 配置web站点:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
mkdir  /www/wwwroot/awstats
cd /usr/local/awstats/wwwroot/
cp -ar  css icon js  /www/wwwroot/awstats/
chown  -R www.www  /www/wwwroot/awstats

生成分析日志

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@clsn nginx]# /usr/local/awstats/tools/awstats_buildstaticpages.pl  \
-config=nmtui.com -update -lang=cn \
-awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl \
-dir=/www/wwwroot/awstats/

Launch update process : "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -update -configdir=
Build main page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output
Build alldomains page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=alldomains
Build allhosts page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=allhosts
Build lasthosts page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=lasthosts
Build unknownip page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=unknownip
Build allrobots page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=allrobots
Build lastrobots page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=lastrobots
Build session page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=session
Build urldetail page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=urldetail
Build urlentry page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=urlentry
Build urlexit page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=urlexit
Build osdetail page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=osdetail
Build unknownos page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=unknownos
Build browserdetail page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=browserdetail
Build unknownbrowser page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=unknownbrowser
Build downloads page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=downloads
Build refererse page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=refererse
Build refererpages page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=refererpages
Build keyphrases page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=keyphrases
Build keywords page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=keywords
Build errors400 page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=errors400
Build errors403 page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=errors403
Build errors404 page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=nmtui.com -staticlinks -lang=cn -output=errors404
23 files built.
Main HTML page is 'awstats.nmtui.com.html'.

修改nginx配置(修改完成后重新加载nginx配置文件):

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@clsn nginx]# cat   awstats.nmtui.com.conf
server
{
    listen 80;
    server_name awstats.nmtui.com;
    index awstats.nmtui.com.html;
    root /www/wwwroot/awstats/;
    access_log  /www/wwwlogs/awstats.nmtui.com.log;
    error_log  /www/wwwlogs/awstats.nmtui.com-error.log;
}
[root@clsn nginx]# /etc/init.d/nginx  reload

3.4添加定时任务

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
# 添加定时任务,定时更新awstats分析日志

4.安全加固

4.1使用htpasswd生成加密密码

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@clsn nginx]# yum install httpd-tools -y
[root@clsn nginx]# htpasswd  -c /usr/local/awstats/wwwroot/nmtui.passwd nmtui
New password:
Re-type new password:
Adding password for user nmtui
[root@clsn nginx]# chown www.www  /usr/local/awstats/wwwroot/nmtui.passwd
[root@clsn nginx]# chmod 600  /usr/local/awstats/wwwroot/nmtui.passwd

4.2添加web访问认证

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@clsn nginx]# vim  awstats.nmtui.com.conf
server
{
    listen 80;
    server_name awstats.nmtui.com;
    index awstats.nmtui.com.html;
    root /www/wwwroot/awstats/;
    auth_basic "clsn training";
    auth_basic_user_file /usr/local/awstats/wwwroot/nmtui.passwd;
    access_log  /www/wwwlogs/301-clsn.io.log;
    error_log  /www/wwwlogs/301-clsn.io-error.log;
}
[root@clsn nginx]# /etc/init.d/nginx  reload

5.查看分析日志

5.1安全加固生效

5.2 分析日志显示正常

6.参考文献

  • https://awstats.sourceforge.io/docs
  • https://www.cnblogs.com/weiji100/p/3845255.html
  • https://www.cnblogs.com/liangml/p/6421426.html
  • http://clsn.io/clsn-ops/ops-linux/
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-11-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
awstats 安装
来自 http://www.cnblogs.com/fnng/archive/2012/08/31/2666175.html
全栈程序员站长
2022/09/13
2120
awstats分析nginx日志「建议收藏」
看了awstats介绍后,感觉是个好东西,等装好来用的时候,不像那么一回事。awstats说白了就是对nginx,apache产生的日志进行分析。awstats分析出来的数据不准,日志是按照一定的规则来生成的,把访问数据存入到文件中,但是数据存入的时候可能是不全的,awstats分析的时候就有误差。
全栈程序员站长
2022/09/13
5820
awstats分析nginx日志「建议收藏」
Fedora下安装日志分析工具AWStats
之前用Google Analytics分析网站,觉得多一次请求,对用户不太好,于是自己分析统计apache log。大约花了一个小时安装测试awstats,比预期的要顺利。
星哥玩云
2022/07/03
2350
日志分析工具Awstats实战之Nginx篇
前言: Awstats 是在 SourceForge 上发展很快的一个基于 Perl 的 WEB 日志分析工具,一个充分的日志分析让 Awstats 显示您下列资料: 访问次数、独特访客人数, 访问时间和上次访问, 使用者认证、最近认证的访问, 每周的高峰时间(页数,点击率,每小时和一周的千字节), 域名/国家的主机访客(页数,点击率,字节,269域名/国家检测, geoip 检测), 主机名单,最近访问和未解析的 IP 地址名单 大多数看过的进出页面, 档案类型, 网站压缩统计表(mod_gzip 或者 mod_deflate), 使用的操作系统 (每个操作系统的页数,点击率 ,字节, 35 OS detected), 使用的浏览器, 机器人访问(检测 319 个机器人), 蠕虫攻击 (5 个蠕虫家族), 搜索引擎,利用关键词检索找到你的地址, HTTP 协议错误(最近查阅没有找到的页面), 其他基于 URL 的个性报导,链接参数, 涉及综合行销领域目的. 贵网站被加入"最喜爱的书签".次数. 屏幕大小(需要在索引页补充一些 HTML 标签). 浏览器的支持比例: Java, Flash, RealG2 reader, Quicktime reader, WMA reader, PDF reader. 负载平衡服务器比率集群报告.
星哥玩云
2022/06/11
1.2K0
日志分析工具Awstats实战之Nginx篇
awstats安装流程「建议收藏」
CustomLog ” /var/log/httpd/access_log” combined
全栈程序员站长
2022/09/13
1.1K0
centos awstats简单安装教程
Awstats的功能老高就不多介绍了,总之老高觉得比百度站长好用太多,不过在安装此软件过程中老高也遇到了不少坑,网上的安装教程看的人眼花缭乱,针对centos的教程更是无法直视,于是造成了此篇文章诞生,看完你也许会觉得安装Awstats确实不难。
老高的技术博客
2022/12/28
4100
Awstats日志分析工具 nginx配置
https://www.cnblogs.com/bestzhang/p/6669878.html
用户5760343
2022/05/19
8150
Awstats日志分析工具 nginx配置
awstats 配置「建议收藏」
awstats 一、首先修改httpd.conf httpd-vhost.conf 把log模式由common改成combined vi /usr/local/apache2/conf/httpd.conf vi /usr/local/apache2/conf/extra/httpd-vhost.conf /usr/local/apache2/bin/apachectl restart
全栈程序员站长
2022/09/13
6460
awstats mysql_Awstats 配置详解
[root@test src]# wget http://prdownloads.sourceforge.net/awstats/awstats-6.95.tar.gz [root@test src]# tar zxvf awstats-6.95.tar.gz [root@test src]# mv awstats-6.95 /usr/local/awstats [root@test src]# mkdir /var/lib/awstats [root@test awsta
全栈程序员站长
2022/09/13
5180
Linux 日志分析工具之awstats详解「建议收藏」
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。 http://freeloda.blog.51cto.com/2033581/1346412
全栈程序员站长
2022/09/07
3.3K0
Linux 日志分析工具之awstats详解「建议收藏」
ELK+FileBeat日志分析系统(正式环境nginx日志)
ElasticSearch、Logstash和Kibana 这里还用到一个插件那就是filebeat进行进行采集日志 添加filebeat插件现在已经是非常提倡的做法
全栈程序员站长
2021/06/08
5640
ELK+FileBeat日志分析系统(正式环境nginx日志)
手把手教你,嘴对嘴传达------Apache日志管理日志(rotatelogs分割工具、AWStats日志分析)
服务安装后,不会生成日志文件不会产生 服务启动后,生成日志文件 访问服务后,日志文件会生成内容
不吃小白菜
2020/09/03
8760
手把手教你,嘴对嘴传达------Apache日志管理日志(rotatelogs分割工具、AWStats日志分析)
搭建ELK日志分析系统
ELK Stack 是Elasticsearch、Logstash、Kiban三个开源软件的组合。在实时数据检索和分析场合,三者通常是配合共用,而且又都先后归于 Elastic.co 公司名下,故有此简称。 ELK Stack成为机器数据分析,或者说实时日志处理领域,开源界的第一选择。和传统的日志处理方案相比,ELK Stack 具有如下几个优点: • 处理方式灵活。Elasticsearch 是实时全文索引,不需要像 storm 那样预先编程才能使用; • 配置简易上手。Elasticsearch 全部采用 JSON 接口,Logstash 是 Ruby DSL 设计,都是目前业界最通用的配置语法设计; • 检索性能高效。虽然每次查询都是实时计算,但是优秀的设计和实现基本可以达到全天数据查询的秒级响应; • 集群线性扩展。不管是 Elasticsearch 集群还是 Logstash 集群都是可以线性扩展的; • 前端操作炫丽。Kibana 界面上,只需要点击鼠标,就可以完成搜索、聚合功能,生成炫丽的仪表板。 官网地址:https://www.elastic.co/cn/ 官网权威指南: https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html 安装指南: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/rpm.html Elasticsearch是实时全文搜索和分析引擎,提供搜集、分析、存储数据三大功能;是一套开放REST和JAVA API等结构提供高效搜索功能,可扩展的分布式系统。它构建于Apache Lucene搜索引擎库之上。 Logstash是一个用来搜集、分析、过滤日志的工具。它支持几乎任何类型的日志,包括系统日志、错误日志和自定义应用程序日志。它可以从许多来源接收日志,这些来源包括 syslog、消息传递(例如 RabbitMQ)和JMX,它能够以多种方式输出数据,包括电子邮件、websockets和Elasticsearch。 Kibana是一个基于Web的图形界面,用于搜索、分析和可视化存储在 Elasticsearch指标中的日志数据。它利用Elasticsearch的REST接口来检索数据,不仅允许用户创建他们自己的数据的定制仪表板视图,还允许他们以特殊的方式查询和过滤数据。
菲宇
2019/06/11
1.3K0
搭建ELK日志分析系统
Apache 配置与应用
Apache HTTP Server 之所以受到众多企业的青睐,得益于其源代码开源,跨平台、功能模块化、可灵活定制等优点,其不仅性能稳定,在安全性方面的表现也十分出色。
全栈程序员站长
2022/09/14
4950
Apache 配置与应用
CentOS 7.2 配置Apache服务(httpd)--下篇
版权声明:本文为木偶人shaon原创文章,转载请注明原文地址,非常感谢。 https://blog.csdn.net/wh211212/article/details/52994505
shaonbean
2019/05/26
5030
Linux Apache 给AWStats 创建 访问密码
CentOS7 安装最新版本 AWStats,在httpd.conf 中加入了alias,可以直接访问网址就进入 浏览。十分不安全。
星哥玩云
2022/07/03
1.1K0
AWStats简介
安装 [url]http://sourceforge.net/projects/awstats/[/url] 下载安装包后: GNU/Linux:tar zxf awstats-version.tgz awstats的脚本和静态文件缺省都在wwwroot目录下:将cgi-bin目录下的文件都部署到 cgi-bin/目录下:/home/apache/cgi-bin/awstats/ mv awstats-version/wwwroot/cgi-bin /path/to/apache/cgi-bin/awstats 把图标等文件目录复制到WEB的HTML文件发布目录下,例如:/home/apache/htdocs/ 下发布 更多的批量更新脚本等在tools 目录下,可以一并放到cgi-bin/awstats/ 目录下 升级国内主要 搜索引擎和蜘蛛定义,安装GeoIP的应用库:C [url]http://www.maxmind.com/download/geoip/api/c/[/url] 解包,编译安装 perl -MCPAN -e ‘install “Geo::IP”‘ 或者使用纯Perl包 perl -MCPAN -e ‘install “Geo::IP::PurePerl”‘ 下载GeoIP/GeoIPCityLite包:解包并部署到awstats目录下:
全栈程序员站长
2022/09/13
4470
Nginx软件优化
1.1 Nginx优化分类 安全优化(提升网站安全性配置) 性能优化(提升用户访问网站效率) 1.2 Nginx安全优化 1.2.1 隐藏nginx版本信息优化 官方配置参数说明:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens 官方参数: Syntax: server_tokens on | off | build | string; Default: server_tokens on; Context: http
惨绿少年
2018/03/30
1.4K0
利用AWStat+JAWStat进行Apache访问日志分析
Apache的访问日志中会记录服务器所处理的所有请求,对apache的访问日志进行分析是一种比较传统的形式。虽然现在很多第三方的统计分析工具提供了嵌入到页面中的JS脚本来进行分析的方式,但是因为两种分析方式的侧重点不同,目前两种形式的日志分析仍并行存在。
大江小浪
2018/07/25
6430
利用AWStat+JAWStat进行Apache访问日志分析
Tomcat安装AWStats做统计
安装perl,下载地址:http://www.activestate.com/activeperl/downloads 根据操作系统版本下载安装,安装时选择将perl加入PATH
星哥玩云
2022/06/28
2140
相关推荐
awstats 安装
更多 >
领券
💥开发者 MCP广场重磅上线!
精选全网热门MCP server,让你的AI更好用 🚀
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验