<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post//</link>
<title><![CDATA[Linux下Apache日志分析工具--AWStats安装使用]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[Linux技术]]></category>
<pubDate>Tue, 17 May 2011 05:52:18 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//</guid> 
<description>
<![CDATA[ 
	1、事先安装好Apache<br/><br/>2、安装awstats的命令(将awstats安装在/opt/awstats目录)<br/>mkdir -p /var/lib/awstats<br/>cd /opt<br/>wget http://www.awstats.cn/files/awstats-6.6.tar.gz<br/>tar zxvf awstats-6.6.tar.gz<br/>mv awstats-6.6 awstats<br/>cd awstats/tools/<br/>perl awstats_configure.pl<br/><br/>3、Perl脚本awstats_configure.pl安装过程(以下内容引用AWStats英文使用说明)<br/><br/>(1)<br/>-----> Running OS detected: Linux, BSD or Unix<br/>Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'.<br/>If you want to use standard directory, you should first move all content<br/>of AWStats distribution from current directory:<br/>/opt/awstats<br/>to standard directory:<br/>/usr/local/awstats<br/>And then, run configure.pl from this location.<br/>Do you want to continue setup from this NON standard directory [yN] ?<br/><br/>这时选择y回车。<br/><br/>(2)<br/>-----> Check for web server install<br/><br/>Enter full config file path of your Web server.<br/>Example: /etc/httpd/httpd.conf<br/>Example: /usr/local/apache2/conf/httpd.conf<br/>Example: c:&#92;Program files&#92;apache group&#92;apache&#92;conf&#92;httpd.conf<br/>Config file path ('none' to skip web server setup):<br/><br/>第一次使用请输入Apache的httpd.conf路径，例如/opt/sina/apache/conf/httpd.conf<br/>以后如果再使用perl awstats_configure.pl生成配置文件，则可以输入none跳过。<br/><br/>(3)<br/>-----> Check and complete web server config file '/opt/sina/apache/conf/httpd.conf'<br/>Warning: You Apache config file contains directives to write 'common' log files<br/>This means that some features can't work (os, browsers and keywords detection).<br/>Do you want me to setup Apache to write 'combined' log files [y/N] ?<br/><br/>选择y，将日志记录方式由CustomLog /yourlogpath/yourlogfile common改为更详细的CustomLog /yourlogpath/yourlogfile combined<br/><br/>(4)<br/>-----> Update model config file '/opt/awstats/wwwroot/cgi-bin/awstats.model.conf'<br/>&nbsp;&nbsp;File awstats.model.conf updated.<br/><br/>-----> Need to create a new config file ?<br/>Do you want me to build a new AWStats config/profile<br/>file (required if first install) [y/N] ?<br/><br/>创建一个新的配置文件，选择y<br/><br/>(5)<br/>-----> Define config file name to create<br/>What is the name of your web site or profile analysis ?<br/>Example: www.mysite.com<br/>Example: demo<br/>Your web site, virtual server or profile name:<br/>><br/><br/>输入站点名称，例如sina<br/><br/>(6)<br/>-----> Define config file path<br/>In which directory do you plan to store your config file(s) ?<br/>Default: /etc/awstats<br/>Directory path to store config file(s) (Enter for default):<br/>><br/><br/>输入AWStats配置文件存放路径，一般直接回车则使用默认路径/etc/awstats<br/><br/>(7)<br/>-----> Add update process inside a scheduler<br/>Sorry, configure.pl does not support automatic add to cron yet.<br/>You can do it manually by adding the following command to your cron:<br/>/opt/awstats/wwwroot/cgi-bin/awstats.pl -update -config=sina<br/>Or if you have several config files and prefer having only one command:<br/>/opt/awstats/tools/awstats_updateall.pl now<br/>Press ENTER to continue...<br/><br/>按回车键继续<br/><br/>(8)<br/>A SIMPLE config file has been created: /opt/awstats/etc/awstats.sina.conf<br/>You should have a look inside to check and change manually main parameters.<br/>You can then manually update your statistics for 'sina' with command:<br/>> perl awstats.pl -update -config=sina<br/>You can also read your statistics for 'sina' with URL:<br/>> http://localhost/awstats/awstats.pl?config=sina<br/><br/>Press ENTER to finish...<br/><br/>按回车键结束<br/><br/>4、修改awstats.sina.conf配置<br/>vi /etc/awstats/awstats.sina.conf<br/><br/>按?，在之后输入要搜索的内容LogFile="<br/>然后按Ins键，找到LogFile="/var/log/httpd/access_log"<br/>改为要分析的Apache日志路径与文件名。<br/><br/>(1)多日志合并分析(例：新浪播客其中两台服务器2月6日的日志30.0206.vblog.log与31.0206.vblog.log)<br/>LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/30.0206.vblog.log /var/apachelogs/31.0206.vblog.log&#124;"<br/>或<br/>LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/*.0206.vblog.log&#124;"<br/><br/>(2)分析使用gzip压缩过的日志文件<br/>LogFile="gzip -d </var/log/apache/access.log.gz&#124;"<br/><br/>5、更新分析报告<br/>perl /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=sina -update<br/><br/>如果出现以下错误提示，很大可能是Apache的Log文件中存在以前CustomLog /yourlogpath/yourlogfile common生成的日志，删除掉这些行的日志即可：<br/>This means each line in your web server log file need to have "combined log format" like this:<br/>111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"<br/><br/>6、查看分析报告<br/>http://localhost/awstats/awstats.pl?config=sina<br/><br/>这里的sina对应/etc/awstats/awstats.sina.conf中的sina<br/><br/>附：<br/>(1)参考资料：AWStats logfile analyzer 6.6 Documentation -- AWStats Installation, Configuration and Reporting (http://www.awstats.cn/docs/awstats_setup.html)<br/>(2)测试环境：在DELL PowerEdge 2950 服务器＋CentOS 4.4 Linux操作系统＋Apache 2.0.59下测试通过。 <br/>Tags - <a href="http://www.zhanghaijun.com/tags/apache/" rel="tag">apache</a> , <a href="http://www.zhanghaijun.com/tags/awstats/" rel="tag">awstats</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post//#blogcomment</link>
<title><![CDATA[[评论] Linux下Apache日志分析工具--AWStats安装使用]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>