标签: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
标签:webalizer
原文地址:http://yangzhiming.blog.51cto.com/4849999/1662009