Apache Server for Windows Little Black Book:Tracking Your Server's Activity
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Apache Server for Windows Little Black Book
(Publisher: The Coriolis Group)
Author(s): Greg Holden with Matthew Keller
ISBN: 1576103919
Publication Date: 01/01/99
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Apaches Log Files
Virtually all servers, including Apache, provide their Webmasters with information contained in log files. Typically, the following types of log files are provided:
Access fileRecords any requests made to the server
Error log fileRecords requests that encounter errors.
Server log fileProvides a record of the servers activity.
Referrer fileStores URLs that contain links to the documents that are actually requested on the server.
Agent fileLists the type of browsers that visitors used to access the server.
Apache provides you with an access log (called access.log) and an error log (error.log) in the logs directory. Referrer information and user agent data are provided by the mod_log_config module. Server status information is provided by ApacheModuleStatus.dll. In addition to mod_log_config, there are two modulesmod_log_agent and mod_log_refererthat you can convert to DLLs and load into Apache: mod_log_agent lets you record information about specific browsers, and mod_log_referer lets you record information about referring URLs used by your visitors. Both modules enable you to store the data in separate log files.
The mod_log_config Module
The mod_log_config module, which is compiled into Apache by default, is the module that produces Apaches log files. By default, it produces data in the standard common log format (CLF), although you can customize the format via the LogFormat directive.
Common Log Format
Common log format is a standardized way of producing log files that was originally defined by NCSA (National Center for Supercomputing Applications) and CERN, the European Laboratory for Particle Physics. It includes seven data fields (called tokens) for each record:
HostProvides either the IP address of the visitor or its fully qualified domain name.
IdentProvides identity information from the client, provided that the clients computer runs identd and the IdentityCheck directive has been enabled.
AuthuserProvides the username for the visitor if the URL that was accessed required Basic HTTP authentication.
DateLists the date and time of the request.
RequestReports the request line that the visitor sent, enclosed in double-primes ('').
BytesRecords the size, in bytes, of the file or object sent to the client.
StatusReports the three-digit HTTP status code sent to the client.
In the actual log file, each token is separated by a blank space, in this format:
host ident authuser date request status bytes
You can use the CustomLog or LogFormat directives to choose other formats for log files. The httpd.conf uses the LogFormat directive to provide definitions of four different log file formats: common, agent, referer, and combined. See Customizing Log Files in the Immediate Solutions section of this chapter for further explanation.
The Access Log File
Apache records all client requests in an access log file that, by default, is called access.log and is located in the logs directory. Some typical lines from the access log might look like this:
127.0.0.1 - - [04/Oct/1998:09:12:29 +0100]
"GET /server-status HTTP/1.0" 404 192
www.acmeinc.com - - [05/Oct/1998:09:13:04 +0100]
"Get /icons/logo.gif HTTP/1.0" 20 370
www.acmeinc.com - - [05/Oct/1998:09:13:04 +0100]
"Get /icons/banner.gif HTTP/1.0" 200 460
www.acmeinc.com - - [05/Oct/1998:09:13:04 +0100]
"Get /icons/advert.gif HTTP/1.0" 200 689
The date field, which is contained within the [] brackets in the preceding lines, can take the following format:
[day/month/year:hour:minute:second zone]
TIP: An interesting article on how to use Perl to interpret Apaches access log file is at www.devdaily.com/perl/edu/articles/pl020003/pl020003.shtml.
You can either change the location of the access log or create specific access logs for any virtual hosts that you serve by using the TransferLog directive. (See Specifying Log Files in the Immediate Solutions section of this chapter.)
The Error Log
Apaches error log is specified by default with the ErrorLog directive in httpd.conf and is located in C:\Apache\logs\error.log. Using the LogLevel directive, you can tell Apache what kinds of error messages should be recorded in the log. (See Recording Server Errors in the Immediate Solutions section of this chapter.)
Rotating Logs
Its important to remember that log files are always open while Apache is running. They can accumulate data and grow at an alarming rate. If you have multiple log files on your server, they can easily begin to consume a substantial amount of hard disk space.
You should maintain your log files by periodically rotating them. This means that you stop the server, copy the files to another disk or another computer, and restart the server. When the server restarts, it will create new log files that you have specified with CustomLog and TransferLog.
The Windows version of Apache does not have utilities such as rotatelog that handle log file rotation automatically without requiring that you restart the server. Currently, you have to stop the server and make your Web site(s) unavailable for a short time until you restart.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
AC PG USBASP UG V1 229TYT (226)225 226highwaycode pol c11 niekozystne warunki atmosferyczne (s 77 79, r 229 237)226 av 04 226strona219 22607 (226)v 04 229więcej podobnych podstron