Tomcat 安装webalizer


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



安装tomcat7 略


# apt-get install webalizer


修改tomcat log格式


# vi /var/lib/tomcat7/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 tomcat7 restart


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


# vi /etc/webalizer/webalizer.conf



LogFile /var/log/tomcat7/localhost_access_log.txt


OutputDir /var/lib/tomcat7/webapps/usage


:wq



启动weblizer


# webalizer


如果出现以下信息,可以访问页面(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@server:~/.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    



你可能感兴趣的:(Webalizer)