Error Log

by GJSenthil 2008-01-18 15:10:58

Module mod_log_config

Log files have the records of all the actions done by the client and all the requests made to server.
These log files must be in a specified format so as to understood easily. This module mod_log_config is used to log the
details of all activities made but in a conditional or customised format. mod_log_config tells about how the logging
of clients request are made in a customised manner. There are three directives under this module.

1. TransferLog - To create a log file
2. LogFormat - To cusotmise the log and
3. CustomLog - To define a log in a specified manner.

The log can be made in the form of strings which argument to the LogFormat and CustomLog directives. There are list of strings
which have individual characteristics. The log entry values which are stored in log as "%" directives. The list of values of
those directives are as follows.

%a: Remote IP-address
%A: Local IP-address
%B: Bytes sent, excluding HTTP headers.
%b: Bytes sent, excluding HTTP headers. In CLF format
i.e. a '-' rather than a 0 when no bytes are sent.
%c: Connection status when response was completed.
'X' = connection aborted before the response completed.
'+' = connection may be kept alive after the response is sent.
'-' = connection will be closed after the response is sent.
%e: The contents of the environment variable FOOBAR
%f: Filename
%h: Remote host
%H The request protocol
%i: The contents of Foobar: header line(s) in the request
sent to the server.
%l: Remote logname (from identd, if supplied)
%m The request method
%n: The contents of note "Foobar" from another module.
%o: The contents of Foobar: 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 query string (prepended with a ? if a query string exists,
otherwise an empty string)
%r: First line of request
%s: Status. For requests that got internally redirected, this is
the status of the *original* request --- %...>s for the last.
%t: Time, in common log format time format (standard english format)
%t: The time, in the form given by format, which should
be in strftime(3) format. (potentially localized)
%T: The time taken to serve the request, in seconds.
%u: Remote user (from auth; may be bogus if return status (%s) is 401)
%U: The URL path requested, not including any query string.
%v: The canonical ServerName of the server serving the request.
%V: The server name according to the UseCanonicalName setting.

Common Log Format

A common log format file is created by the web server to keep track of the requests that occur on a web site
The common log format (CLF)will be like

LogFormat "%h %l %u %t "%r" %>s %b" common
CustomLog logs/access_log common

This defines the nickname common and associates it with a particular log format string. The format string
consists of percent directives, each of which tell the server to log a particular piece of information.

Let us have an example to explain the CLF
[] [-] [-] [20/Jan/2007:01:07:48 -0400] ["tally/~backup/tbk.001 HTTP/1.0"] [100] [80960]

In the above example it shows the log details in percent directives. The actual values of the log are --> remotehost IP address
- --> remote login name
- --> user name
20/Jan/2007:01:07:48 -0400 --> date of the request by client
tally/~backup/tbk.001 HTTP/1.0 --> Actual request by client
100 --> status of request
80960 --> Bytes transfered on request

Tagged in:


You must LOGIN to add comments