A new log format can be defined with the LogFormat directive:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
The common log format is a good starting place for creating your own custom log formats. Note that most of the available log analysis tools assume that you are using the common log format or the combined log format — both of which are defined in the default configuration files.
The following variables are available for LogFormat statements:
%a |
Remote IP address. |
%A |
Local IP address. |
%b |
Bytes sent, excluding HTTP headers. This is shown in Apache's Combined Log Format (CLF). For a request without any data content, a - is shown instead of 0. |
%B |
Bytes sent, excluding HTTP headers. |
%{VARIABLE}e |
The contents of the environment variable variable. |
%f |
The filename of the output log. |
%h |
Remote host. |
%H |
Request protocol. |
%{HEADER}i |
The contents of header; header line(s) in the request sent to the server. |
%l |
Remote log name (from identd, if supplied). |
%m |
Request method. |
%{NOTE}n |
The contents of note NOTE from another module. |
%{HEADER}o |
The contents of header; header line(s) in the reply. |
%p |
The canonical port of the server serving the request. |
%P |
The process ID of the child that serviced the request. |
%q |
The contents of the query string, prepended with a ? character. If there's no query string, this evaluates to an empty string. |
%r |
The first line of request. |
%s |
Status. For requests that were internally redirected, this is the status of the original request — %>s for the last. |
%t |
The time, in common log time format. |
%{format}t |
The time, in the form given by format, which should be in strftime(3) format. |
%T |
The seconds taken to serve the request. |
%u |
Remote user from auth; this might be bogus if the return status (%s) is 401. |
%U |
The URL path requested. |
%V |
The server name according to the UseCanonicalName directive. |
%v |
The canonical ServerName of the server serving the request. |
You can put a conditional in front of each variable to determine whether the variable is displayed. If the variable isn't displayed, — is displayed instead. These conditionals are in the form of a list of numerical return values. For example, %!401u displays the value of REMOTE_USER unless the return code is 401.
You can then specify the location and format of a log file by using the CustomLog directive:
CustomLog logs/access_log common
If it isn't specified as an absolute path, the location of the log file is assumed to be relative to the ServerRoot.
You will use these commands when managing your Apache web server in Fedora:
► apachectl — Server control shell script included with Apache
► system-config-httpd — Red Hat's graphical web server configuration tool
► httpd — The Apache web server
► konqueror — KDE's graphical web browser
► elinks — A text-based, graphical menu web browser
► firefox — The premier open source web browser
Reference
► http://news.netcraft.com/archives/web_server_survey.html — A statistical graph of web server usage points out that Apache is, by far, the most widely used server for Internet sites.
► http://www.apache.org/ — Extensive documentation and information about Apache are available at The Apache Project website.
► http://apachetoday.com/ — Another good Apache site. Original content as well as links to Apache-related stories on other sites can be found at Apache Today's site.
► http://modules.apache.org/ — Available add-on modules for Apache can be found at The Apache Module Registry website.
There are several good books about Apache. For example, see Apache Server Unleashed (Sams Publishing), ISBN 0-672-31808-3.
CHAPTER 18
Administering Database Services
This chapter is an introduction to MySQL and PostgreSQL, two database systems that are included with Fedora. You'll learn what these systems do, how the two programs compare, and how to consider their advantages and disadvantages. This information can help you choose and deploy which one to use for your organization's data base needs.