linux下日志监控分析工具awstat的安装与使用

本文发布时间: 2019-Mar-22
awstat的功能:  AWStats是在Sourceforge上发展很快的一个基于Perl的WEB日志分析工具。它可以统计您站点的如下信息:  一:访问量,访问次数,页面浏览量,点击数,数据流量等  二:精确到每月、每日、每小时的数据  三:访问者国家  四:访问者IP  五:Robots/Spiders的统计  六:纺客持续时间  七:对不同Files type 的统计信息  八:Pages-URL的统计  九:访客操作系统浏览器等信息  十:其它信息(搜索关键字等等)下面开始介绍awstats的安装:(安装包请读者自行下载)安装之前首先启动apache,并查看进程(在之前的实验里,我们将其设为了开机启动,所以就不在start了,或者执行restart也可以)[root@localhost ~]# netstat -tupln|grep httptcp 0 0 :::80 :::* LISTEN 3787/httpd You have new mail in /var/spool/mail/root[root@localhost ~]#解压包到/usr/local/awstats目录下[root@localhost ~]# tar zxvf awstats-7.1.1.tar.gz -C /usr/local/awstats确定系统已经安装perl[root@localhost ~]# whereis perlperl: /usr/bin/perl /usr/share/man/man1/perl.1.gz[root@localhost ~]#编译awstats:(进入/usr/local/awstats/awstats-7.1.1/tools/目录下)[root@localhost ~]# cd /usr/local/awstats/awstats-7.1.1/tools/[root@localhost tools]# perl awstats_configure.pl#如果系统已安装apache的话,自动会检测到配置文件----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----This tool will help you to configure AWStats to analyze statistics forone web server. You can try to use it to let it do all that is possiblein AWStats setup, however following the step by step manual setupdocumentation (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 UnixWarning: AWStats standard directory on Linux OS is '/usr/local/awstats'.If you want to use standard directory, you should first move all contentof AWStats distribution from current directory:/usr/local/awstats/awstats-7.1.1to standard directory:/usr/local/awstatsAnd then, run configure.pl from this location.Do you want to continue setup from this NON standard directory [yN] ? y-----> Check for web server installFound Web server Apache config file '/etc/httpd/httpd.conf'-----> Check and complete web server config file '/etc/httpd/httpd.conf'Warning: You Apache config file contains directives to write 'common' log filesThis means that some features can't work (os, browsers and keywords detection).Do you want me to setup Apache to write 'combined' log files [y/N] ? yAdd 'Alias /awstatsclasses "/usr/local/awstats/awstats-7.1.1/wwwroot/classes/"'Add 'Alias /awstatscss "/usr/local/awstats/awstats-7.1.1/wwwroot/css/"'Add 'Alias /awstatsicons "/usr/local/awstats/awstats-7.1.1/wwwroot/icon/"'Add 'ScriptAlias /awstats/ "/usr/local/awstats/awstats-7.1.1/wwwroot/cgi-bin/"'Add '<Directory>' directiveAWStats directives added to Apache config file.-----> Update model config file '/usr/local/awstats/awstats-7.1.1/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/profilefile (required if first install) [y/N] ? y-----> Define config file name to createWhat is the name of your web site or profile analysis ?Example: www.mysite.comExample: demoYour web site, virtual server or profile name:> AnalyzeApacheLog-----> Define config file pathIn which directory do you plan to store your config file(s) ?Default: /etc/awstatsDirectory path to store config file(s) (Enter for default):> (直接回车,默认就好)-----> Create config file '/etc/awstats/awstats.AnalyzeApacheLog.conf'Config file /etc/awstats/awstats.AnalyzeApacheLog.conf created.-----> Restart Web server with '/sbin/service httpd restart'停止 httpd: [确定]启动 httpd: [确定]-----> Add update process inside a schedulerSorry, 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/awstats-7.1.1/wwwroot/cgi-bin/awstats.pl -update -config=AnalyzeApacheLogOr if you have several config files and prefer having only one command:/usr/local/awstats/awstats-7.1.1/tools/awstats_updateall.pl nowPress ENTER to continue...A SIMPLE config file has been created: /etc/awstats/awstats.AnalyzeApacheLog.confYou should have a look inside to check and change manually main parameters.You can then manually update your statistics for 'AnalyzeApacheLog' with command:> perl awstats.pl -update -config=AnalyzeApacheLogYou can also read your statistics for 'AnalyzeApacheLog' with URL:> http://localhost/awstats/awstats.pl?config=AnalyzeApacheLogPress ENTER to finish...[root@localhost tools]#查看配置文件:[root@localhost tools]# vim /etc/awstats/awstats.AnalyzeApacheLog.confLogFile="/var/log/httpd/mylog.log"(默认的存放路径)注:(1)如果同时分析多个日志LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/30.0206.vblog.log /var/apachelogs/31.0206.vblog.log|"或LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/*.0206.vblog.log|"(2)分析使用gzip压缩过的日志文件LogFile="gzip -d </var/log/apache/access.log.gz|"


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表