awstats 统计nginx日志
2011-01-06 16:21
453 查看
Awstats 是一个免费非常简洁而且强大有个性的统计工具。它可以统计您站点的如下信息:
① 访问量,访问次数,页面浏览量,点击数,数据流量等
② 精确到每月、每日、每小时的数据
③ 访问者国家
④ 访问者 IP
⑤ Robots/Spiders 的统计
⑥ 纺客持续时间
⑦ 对不同 Files type 的统计信息
⑧ Pages-URL 的统计
⑨ 访客操作系统浏览器等信息
其它信息(搜索关键字等等)
AWStats 是一个免费的强大而有个性的工具,带来先进的网络流量,FTP 或邮件服务器统计图。 本日志分析器作为 CGI 或从命令行在数个图形网页中显示你日志中包含的所有可能信息。 它利用一部分档案资料就能经常很快地处理大量日志档案,它能分析日志文件来自从各大服务器工具,如 Apache日志档案(NCSA combined/XLF/ELF log format or common/CLF log format), WebStar,IIS (W3C的日志格式)及许多其他网站,Proxy(代理服务器)、Wap、流量服务器、邮件服务器和一些 FTP 服务器。
看一看这个比较表在最著名统计工具(AWStats, Analog, Webalizer,...)之间有何特点和不同的想法.
AWStats 是一个在 GNU 通用公共许可证下发行的免费软件。你可以看看这个许可证图表而知道你可以/不可以做。
由于AWStats工程来自网上信息,但也作为CGI、 它可以与允许进入Perl,CGI与日志的大型网站主办提供商一起工作。
==============================================================================
最近公司要求对日志分析,web服务器统一都是nginx,所以针对nginx日志分析,经过一番筛选,像收费的Clicky、Clicktale、MSBI等不考虑,最终用awstats,先前使用过,今天留个笔记!
# cp -r awstats-7.0 /usr/local/awstats
# cd /usr/local/awstats/tools
# perl awstats_configure.pl
安装过程中会让你回答下列等问题
Do you want me to setup Apache to write ‘combined’ log files [y/N] ? y
Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ? y
Your web site, virtual server or profile name:
> www.18481.com
Directory path to store config file(s) (Enter for default):
>
其余一律回车,不带考虑。爷们就这么痛快 = =!
安装过程会自动在httpd.conf文件中添加下面的配置信息
Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”
Alias /awstatscss “/usr/local/awstats/wwwroot/css/”
Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”
ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”
Options None
AllowOverride None
Order allow,deny
Allow from all
==========================================================================
修改主机配置文件(/etc/awstats/awstats.www.18481.com.conf),重点检查LogFile、LogType、LogFormat、 SiteDomainin、HostAlias这几个选项
# cp /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/common.conf
# vi /etc/awstats/awstats.www.18481.com.conf
Include "common.conf"
#LogFile="/var/log/httpd/mylog.log"
LogFile="/var/log/nginx/www.18481.com_access_%YYYY-24%MM-24%DD-24".log
# %YYYY-24%MM-24%DD-24是指用24小时前的年月日日志文件名,如access_log.20100106
SiteDomain="www.18481.com"
HostAliases="www.18481.com www.18481.com 127.0.0.1 localhost"
DefaultFile="index.html"
DirData="/var/lib/awstats"
更新数据
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl --update -config=www.18481.com
Error: AWStats database directory defined in config file by 'DirData' parameter (/var/lib/awstats) does not exist or is not writable.
Setup ('/etc/awstats/awstats.www.18481.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
对于 /var/lib/awstats 目录没有写入权限造成的
# chmod 777 /var/lib/awstats
chmod: cannot access `/var/lib/awstats': No such file or directory
# mkdir /var/lib/awstats
# chmod 777 /var/lib/awstats
更新数据
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl --update -config=www.18481.com
Create/Update database for config "/etc/awstats/awstats.www.18481.com.conf" by AWStats version 6.9 (build 1.925)
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: 8
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 8 new qualified records.
分析log,生成index.html文件
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.18481.com -update -output > /usr/local/awstats/wwwroot/index.html
定时统计主机日志
#update awstats
30 7 * * * root /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.18481.com –update
测试 http://192.168.1.2/awstats/awstats.pl?config=www.18481.com http://192.168.1.2/awstats/
基于用户的访问控制
配置如下:
[root@www ~]# vi /usr/local/apache2/conf/httpd.conf
<Directory "/usr/local/awstats/wwwroot">
AuthName "AWSTATS "
AuthType Basic
AuthUserFile /usr/local/awstats/wwwroot/.htpasswd
require valid-user
</Directory>
创建存储认证用户账号及口令的文件,创建一个新用户awuser,输入两次密码
/usr/local/apache2/bin/htpasswd -c /usr/local/awstats/wwwroot/.htpasswd awuser
参考:http://hi.baidu.com/crazyunix/blog/item/960880c05ac9c9bb8226acd1.html
本文出自 “奋斗的小子” 博客,请务必保留此出处http://crazyming.blog.51cto.com/1048571/473086
① 访问量,访问次数,页面浏览量,点击数,数据流量等
② 精确到每月、每日、每小时的数据
③ 访问者国家
④ 访问者 IP
⑤ Robots/Spiders 的统计
⑥ 纺客持续时间
⑦ 对不同 Files type 的统计信息
⑧ Pages-URL 的统计
⑨ 访客操作系统浏览器等信息
其它信息(搜索关键字等等)
AWStats 是一个免费的强大而有个性的工具,带来先进的网络流量,FTP 或邮件服务器统计图。 本日志分析器作为 CGI 或从命令行在数个图形网页中显示你日志中包含的所有可能信息。 它利用一部分档案资料就能经常很快地处理大量日志档案,它能分析日志文件来自从各大服务器工具,如 Apache日志档案(NCSA combined/XLF/ELF log format or common/CLF log format), WebStar,IIS (W3C的日志格式)及许多其他网站,Proxy(代理服务器)、Wap、流量服务器、邮件服务器和一些 FTP 服务器。
看一看这个比较表在最著名统计工具(AWStats, Analog, Webalizer,...)之间有何特点和不同的想法.
AWStats 是一个在 GNU 通用公共许可证下发行的免费软件。你可以看看这个许可证图表而知道你可以/不可以做。
由于AWStats工程来自网上信息,但也作为CGI、 它可以与允许进入Perl,CGI与日志的大型网站主办提供商一起工作。
==============================================================================
最近公司要求对日志分析,web服务器统一都是nginx,所以针对nginx日志分析,经过一番筛选,像收费的Clicky、Clicktale、MSBI等不考虑,最终用awstats,先前使用过,今天留个笔记!
安装awstat
# tar zxvf awstats-7.0.tar.gz# cp -r awstats-7.0 /usr/local/awstats
# cd /usr/local/awstats/tools
# perl awstats_configure.pl
安装过程中会让你回答下列等问题
Do you want me to setup Apache to write ‘combined’ log files [y/N] ? y
Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ? y
Your web site, virtual server or profile name:
> www.18481.com
Directory path to store config file(s) (Enter for default):
>
其余一律回车,不带考虑。爷们就这么痛快 = =!
安装过程会自动在httpd.conf文件中添加下面的配置信息
Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”
Alias /awstatscss “/usr/local/awstats/wwwroot/css/”
Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”
ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”
Options None
AllowOverride None
Order allow,deny
Allow from all
==========================================================================
修改主机配置文件(/etc/awstats/awstats.www.18481.com.conf),重点检查LogFile、LogType、LogFormat、 SiteDomainin、HostAlias这几个选项
# cp /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/common.conf
# vi /etc/awstats/awstats.www.18481.com.conf
Include "common.conf"
#LogFile="/var/log/httpd/mylog.log"
LogFile="/var/log/nginx/www.18481.com_access_%YYYY-24%MM-24%DD-24".log
# %YYYY-24%MM-24%DD-24是指用24小时前的年月日日志文件名,如access_log.20100106
SiteDomain="www.18481.com"
HostAliases="www.18481.com www.18481.com 127.0.0.1 localhost"
DefaultFile="index.html"
DirData="/var/lib/awstats"
更新数据
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl --update -config=www.18481.com
Error: AWStats database directory defined in config file by 'DirData' parameter (/var/lib/awstats) does not exist or is not writable.
Setup ('/etc/awstats/awstats.www.18481.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
对于 /var/lib/awstats 目录没有写入权限造成的
# chmod 777 /var/lib/awstats
chmod: cannot access `/var/lib/awstats': No such file or directory
# mkdir /var/lib/awstats
# chmod 777 /var/lib/awstats
更新数据
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl --update -config=www.18481.com
Create/Update database for config "/etc/awstats/awstats.www.18481.com.conf" by AWStats version 6.9 (build 1.925)
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: 8
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 8 new qualified records.
分析log,生成index.html文件
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.18481.com -update -output > /usr/local/awstats/wwwroot/index.html
定时统计主机日志
#update awstats
30 7 * * * root /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.18481.com –update
测试 http://192.168.1.2/awstats/awstats.pl?config=www.18481.com http://192.168.1.2/awstats/
基于用户的访问控制
配置如下:
[root@www ~]# vi /usr/local/apache2/conf/httpd.conf
<Directory "/usr/local/awstats/wwwroot">
AuthName "AWSTATS "
AuthType Basic
AuthUserFile /usr/local/awstats/wwwroot/.htpasswd
require valid-user
</Directory>
创建存储认证用户账号及口令的文件,创建一个新用户awuser,输入两次密码
/usr/local/apache2/bin/htpasswd -c /usr/local/awstats/wwwroot/.htpasswd awuser
参考:http://hi.baidu.com/crazyunix/blog/item/960880c05ac9c9bb8226acd1.html
本文出自 “奋斗的小子” 博客,请务必保留此出处http://crazyming.blog.51cto.com/1048571/473086
相关文章推荐
- awstats 统计 nginx日志切割
- awstats统计分析nginx日志
- awstats分析nginx日志文件
- 使用awstats分析Nginx的访问日志
- awk查看与统计nginx访问日志
- 【SHELL】统计Nginx访问日志状态码
- awstats和jawstats对apache、nginx进行多站点日志分析
- 烂泥:利用awstats分析nginx日志
- (总结)统计Apache或Nginx访问日志里的独立IP访问数量的Shell
- nginx+awstats日志分析工具安装<1>
- 用cat、awk、sort、head统计分析nginx访问日志
- php统计nginx访问日志的ip访问量
- nginx+awstats多域名日志分析<2>
- AWStats的千万级日志解决方案(按日、月统计)
- Nginx+awstats+jawstats 继续WEB日志分析
- nginx简单的日志shell分析统计脚本
- AWStats 分析nginx日志
- awstats分析nginx日志(简单配置)
- Nginx 日志分析 AWStats + JAWStats 安装配置
- 一个简易的python脚本统计nginx日志里的url及大小