⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asg13.htm

📁 apache技术手册
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<HTML>

<HEAD>

<TITLE>Apache Server Survival Guide asg13.htm </TITLE>

<LINK REL="ToC" HREF="index.htm" tppabs="http://docs.rinet.ru:8080/Apachu/index.htm">

<LINK REL="Index" HREF="htindex.htm" tppabs="http://docs.rinet.ru:8080/Apachu/htindex.htm">

<LINK REL="Next" HREF="asgpt5.htm" tppabs="http://docs.rinet.ru:8080/Apachu/asgpt5.htm">

<LINK REL="Previous" HREF="asg12.htm" tppabs="http://docs.rinet.ru:8080/Apachu/asg12.htm"></HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<!--#exec cmd="/www/docs/ssi-bin/restricted_search.ssi"-->





<!--#exec cmd="/www/docs/ssi-bin/inc.ssi"-->






<A NAME="I0"></A>

<H2>Apache Server Survival Guide asg13.htm</H2>

<P ALIGN=LEFT>

<A HREF="asg12.htm" tppabs="http://docs.rinet.ru:8080/Apachu/asg12.htm" TARGET="_self"><IMG SRC="purprev.gif" tppabs="http://docs.rinet.ru:8080/Apachu/purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>

<A HREF="index.htm" tppabs="http://docs.rinet.ru:8080/Apachu/index.htm" TARGET="_self"><IMG SRC="purtoc.gif" tppabs="http://docs.rinet.ru:8080/Apachu/purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>

<A HREF="asgpt5.htm" tppabs="http://docs.rinet.ru:8080/Apachu/asgpt5.htm" TARGET="_self"><IMG SRC="purnext.gif" tppabs="http://docs.rinet.ru:8080/Apachu/purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>


<HR ALIGN=CENTER>

<P>

<UL>

<UL>

<UL>

<LI>

<A HREF="#E68E150" >Apache Standard Access Logs (Common Logfile Format)</A>

<UL>

<LI>

<A HREF="#E69E152" >Fields Available in the CLF</A>

<LI>

<A HREF="#E69E153" >Enabling Logging</A></UL>

<LI>

<A HREF="#E68E151" >Additional Logging Modules</A>

<LI>

<A HREF="#E68E152" >The mod_log_config Module</A>

<UL>

<LI>

<A HREF="#E69E154" >LogFormat</A></UL>

<LI>

<A HREF="#E68E153" >The Error Log</A>

<LI>

<A HREF="#E68E154" >Searching and Gathering</A>

<UL>

<LI>

<A HREF="#E69E155" >Counting the Unique Number of Visitors</A>

<LI>

<A HREF="#E69E156" >Using grep to Determine the Origin of the User</A>

<LI>

<A HREF="#E69E157" >Daily Statistics</A>

<LI>

<A HREF="#E69E158" >Home Page Statistics</A>

<LI>

<A HREF="#E69E159" >Searching the Error Log</A></UL>

<LI>

<A HREF="#E68E155" >Tools for Summarizing Information</A>

<UL>

<LI>

<A HREF="#E69E160" >AccessWatch</A>

<LI>

<A HREF="#E69E161" >Wusage</A>

<LI>

<A HREF="#E69E162" >Analog</A>

<LI>

<A HREF="#E69E163" >wwwstat</A></UL>

<LI>

<A HREF="#E68E156" >Summary</A></UL></UL></UL>

<HR ALIGN=CENTER>

<A NAME="E66E13"></A>

<H1 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>13</B></FONT></CENTER></H1>

<BR>

<A NAME="E67E18"></A>

<H2 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>Web Accounting</B></FONT></CENTER></H2>

<BR>

<P>Soon after a Web site is up and running, you will get many requests for Web traffic statistics. Log administration in terms of providing accounting information, &quot;Web accounting,&quot; will be one of the primary services you'll be involved with after your Web site is up and running.

<BR>

<P>The importance and relevance of any Web accounting information depends on what you are going to do with it. If you are not going to do anything with this information, then don't even enable it!

<BR>

<P>However, Web accounting allows you to create a database of information that you can use in many aspects of your Web site administration. Even when deciding to implement a browser-specific feature, you may be interested in knowing how many visitors will be able to take advantage of the new feature. Logging provides the answers to this question and others, including the following:

<BR>

<UL>

<LI>Who is visiting your Web site?

<BR>

<BR>

<LI>How many visitors are there and where are they from?

<BR>

<BR>

<LI>When do international users visit your Web site?

<BR>

<BR>

<LI>Which Web sites refer visitors to your Web site?

<BR>

<BR>

<LI>What are the most popular areas of your Web site?

<BR>

<BR>

<LI>Which browsers do your visitors use?

<BR>

<BR>

<LI>What are your Web site's peak load times?

<BR>

<BR>

<LI>Is your Web site working properly?

<BR>

<BR>

</UL>

<P>All this information can be very useful to you as an administrator of the site and to the people responsible for the content. This accounting information can provide immediate feedback as to how your site is being accepted by the Internet community. If the service is useful, you will want to know which sections are more attractive to visitors and which areas need improvement. This information gives you the opportunity to modify and tweak your site to make it more responsive to your visitors needs.

<BR>

<P>Sites that thrive on traffic will also be very interested in the traffic patterns because the cost of advertising could be rated according to the access patterns for a page. Instead of having a flat rate, you could develop a random ad banner. Ads could be targeted to match the profile of your visitors. The type of ad that appears can be dependent on factors such as the time of day, where the visitor is coming from, and so on. The possibilities are many. <A HREF="asg05.htm" tppabs="http://docs.rinet.ru:8080/Apachu/asg05.htm">Chapter 5</A>, &quot;CGI (Common Gateway Interface) Programming,&quot; develops a program that you can use for implementing random banners.

<BR>

<P>Over time, your traffic information will grow to provide sufficient statistical information that depicts interesting patterns such as the resources most frequently requested, the peak times and days for server access, and the way that people travel from page to page.

<BR>

<P>As an administrator, your main interests will probably be centered around the overall traffic generated in terms of transfer rates. How much is requested will impact the overall performance of your server and network. The monitoring of the error logs should also be important. The error logs will provide you with information about broken links, security violation attempts, and problems related to your CGI programs. If you decide to log, you'll also have to deal with the physical management of the log files. They grow, and they grow fast!

<BR>

<P>Monitoring logs is an important task because it provides you with vital information and also acts as an indicator of the proper operation of your site.

<BR>

<P>Monitoring your site's traffic can be accomplished with many tools. Some of which are already built into your system. This chapter explores different ways that you can sift through the information and summarizes the results into useful information.

<BR>

<BR>

<A NAME="E68E150"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Apache Standard Access Logs (Common Logfile Format)</B></FONT></CENTER></H3>

<BR>

<P>The Apache server provides several logging modules that will help you keep track of many things. The standard logging module, called mod_log_common, is built into Apache by default. This module logs requests using the Common Logfile Format (CLF).

<BR>

<P><A NAME="I2"></A>Starting with Apache 1.2, the default logging module will be via mod_log_config, a fully configurable module. mod_log_config is explained in the &quot;The mod_log_config Module&quot; section later in this chapter.

<BR>

<P>The CLF is used by all major Web servers, including Apache. This is a good thing, because it means that you'll be able to run several log analysis tools that are both freely and commercially available for this purpose.

<BR>

<P>The CLF lists each request on a separate line. A line is composed of several fields separated by spaces. Fields for which information could not be obtained contain a dash character (-). Each log entry uses the following format:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080"><I>host ident authuser date request status bytes</I></FONT></PRE>

<BR>

<A NAME="E69E152"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Fields Available in the CLF</B></FONT></CENTER></H4>

<BR>

<P>Here's a list of the data each field contains:

<BR>



<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="80%" CELLPADDING=2 >

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>host</I>

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

The <I>host</I> field contains the fully qualified domain name or IP, if the name was not available, of the machine that made the request.</FONT>

</TABLE><BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>From a performance standpoint, you should not force your server to perform a reverse Domain Name System (DNS) lookup of the client. Some of the logging tools I'll describe can perform this reverse lookup at the time you create your reports. Apache 1.1.1 ships with a little support utility called, logresolve, which will obtain this information from the IP address stored in the log.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="80%" CELLPADDING=2 >

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>ident</I>

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

If IdentityCheck is enabled and the client machine was running an identity daemon, the <I>ident</I> field will contain the name of the user that made the request. You should never trust this information, unless you know that the host is trusted. Otherwise, understand that this information can be spoofed and is not trustworthy, don't bother enabling it!

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>authuser</I>

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

If the request required authentication, the <I>authuser</I> field will contain the login of the user who made the request.

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>date</I>

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

The <I>date</I> field contains the date and time of the request, including the offset from Greenwich Mean Time. The date format used is <I>day/month/year:hour:minute:second </I><I>timezone</I>

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>request</I>

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

The <I>request</I> field is set to the actual request received from the client. It is enclosed in double quotes (&quot;).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -