码迷,mamicode.com
首页 > Web开发 > 详细

Tomcat 安装webalizer

时间:2015-06-15 16:48:13      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:webalizer


Tomcat 安装webalizer(可以统计tomcat web的访问情况)



安装tomcat 略(以tomcat 6为例,7基本相同)


# apt-get install webalizer


修改tomcat log格式


# vi /var/lib/tomcat6/conf/server.conf  (加上rotatable="false",在该文件最后)


 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  

               prefix="localhost_access_log" suffix=".txt" pattern="common" 


resolveHosts="false" rotatable="false"/>      (注意去掉prefix="localhost_access_log."最后的"."



默认为:


 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  

               prefix="localhost_access_log." suffix=".txt" pattern="common" 


resolveHosts="false" />



:wq



# service tomcat6 restart


# mv /var/www/weblizer  /var/lib/tomcat6/webapps/usage


# vi /etc/webalizer/webalizer.conf



LogFile /var/log/tomcat6/localhost_access_log.txt


OutputDir /var/lib/tomcat6/webapps/usage


:wq



启动weblizer


# weblizer


如果出现以下信息,可以访问页面(http://ip:8080/usage)后再执行webalizer即可


root@hudsonL09:~/.ssh# webalizer 

Webalizer V2.01-10 (Linux 3.5.0-23-generic) locale: en_US.UTF-8

Using logfile /var/log/tomcat7/localhost_access_log.txt (clf)

Using default GeoIP database

Creating output in /var/lib/tomcat7/webapps/usage

Hostname for reports is ‘hudsonL09‘

History file not found...

No valid records found!




如果出现以下信息就说明可正常访问了


root@hudsonL09:~/.ssh# webalizer 

Webalizer V2.01-10 (Linux 3.5.0-23-generic) locale: en_US.UTF-8

Using logfile /var/log/tomcat7/localhost_access_log.txt (clf)

Using default GeoIP database

Creating output in /var/lib/tomcat7/webapps/usage

Hostname for reports is ‘hudsonL09‘

History file not found...

Generating report for June 2015

Generating summary report

Saving history information...

53 records in 0.50 seconds




访问:http://ip:8080/usage    



本文出自 “linux” 博客,请务必保留此出处http://yangzhiming.blog.51cto.com/4849999/1662009

Tomcat 安装webalizer

标签:webalizer

原文地址:http://yangzhiming.blog.51cto.com/4849999/1662009

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!