Configure the access log file in Tomcat and use AWStats to configure and analyze logs (tomcat5.5 6.0 passed the test)

Source: Internet
Author: User

Tomcat5.5 configuration instructions
------------------------------ Configure Tomcat --------------------------------------------
1. Enable the access log file and modify the configuration file server. XML in Tomcat.
<Valve classname = "org. Apache. Catalina. Valves. fastcommonaccesslogvalve" directory = "logs"

Prefix = "localhost_access_log." suffix = ". log" pattern = "combined" filedateformat = "yyyy-mm-dd" resolvehosts = "false"/>

A. Cancel comments
B. Modify suffix = ". txt" to suffix = ". log"
C. pattern = "combined"
D. Add the filedateformat = "yyyy-mm-dd" attribute"

2. Rename (tomcat6.0 does not need to be configured)
D: \ Software \ apache-Tomcat-5.5.27 \ Server \ Lib
Servlets-CGI-. renametojar under is the servlets-cgi.jar

3. modify the content. xml file
<? XML version = "1.0" encoding = "UTF-8"?>
<Context privileged = "true">
<Watchedresource> WEB-INF/Web. xml </watchedresource>
</Context>

-------------------------------- Configure AWStats --------------------------------------------
1. Download ActivePerl

Http://www.activestate.com/activeperl

Because AWStats are written in Perl, you must use the ActivePerl interpreter to run AWStats.

2. Download AWStats

Http://sourceforge.net/projects/awstats/

3. Install ActivePerl

4. Decompress AWStats

5. Create an AWStats folder in the tomcat5.5.27 webapps directory.
Copy the decompressed folder docs, tools, and all the cgi-bin folders under wwwroot to the created
Folder, new WEB-INF directory under AWStats, copy cgi-bin to WEB-INF directory, under WEB-INF directory
The content of the new web. xml file is
<? XML version = "1.0" encoding = "ISO-8859-1"?>
<Web-app xmlns = "http://java.sun.com/xml/ns/j2ee"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

Version = "2.4">
<Servlet>
<Servlet-Name> CGI </servlet-Name>
<Servlet-class> org. Apache. Catalina. servlets. cgiservlet </servlet-class>
<Init-param>
<Param-Name> debug </param-Name>
<Param-value> 0 </param-value>
</Init-param>
<Init-param>
<Param-Name> cgipathprefix </param-Name>
<Param-value> WEB-INF/cgi-bin </param-value>
</Init-param>
<Init-param>
<! -- Set the running permission here. Otherwise, java. Io. ioexception: cannot run program "Perl" -->
<! -- Tomcat5.5.27 the following configuration can be set to 6.0. -->
<! -- <Param-Name> executable </param-Name> -->
<! -- <Param-value> CMD/C </param-value> -->

<! -- Tomcat 5.5.27 and tomcat 6.0 can be accessed as follows
Tomcat6.0 executable is Perl by default, but environment variables are set.
The full path must be written in cannotrun program Perl.
-->
<Param-Name> executable </param-Name>
<Param-value> D:/software/perl/bin/perl </param-value>

</Init-param>
<Load-on-startup> 5 </load-on-startup>
</Servlet>
<Servlet-mapping>
<Servlet-Name> CGI </servlet-Name>
<URL-pattern>/cgi-bin/* </url-pattern>
</Servlet-mapping>
<Welcome-file-List>
<Welcome-File> index.html </welcome-File>
<Welcome-File> index.htm </welcome-File>
<Welcome-File> index. jsp </welcome-File>
</Welcome-file-List>
</Web-app>
6. Change AWStats. model. conf under the WEB-INF/cgi-bin directory to common. conf.
The content of creating AWStats. localhost. conf is:
Include "common. conf"
Logfile = "tomcat installation root directory/logs/localhost_access_log. % yyyy-% mm-% dd. log"
Sitedomain = "localhost"
Hostaliases = "localhost 127.0.0.1"
Defaultfile = "index. jsp"
# Create a data folder in cgi-bin
Dirdata = "data"
Dircgi = "/cgi-bin"
Diricons = "/AWStats/icon"
# Allow Log updates on the web page. The default value is 0 (command line update)
Allowtoupdatestatsfrombrowser = 1

7. Restart Tomcat 5.5.27 to access http: // localhost: 8088/AWStats/cgi-bin/AWStats. pl? Config = localhost
OK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.