Next: , Previous: , Up: Configuration   [Contents][Index]


4.3.8 Access Log

GNU Dico provides a feature similar to Apache’s CustomLog, which keeps a log of MATCH and DEFINE requests. To enable this feature, specify the name of the log file using the following directive:

Configuration: access-log-file string

Sets access log file name.

access-log-file /var/log/dico/access.log;

The format of log file entries is defined via the access-log-format directive:

Configuration: access-log-format string

Sets format string for access log file.

Its argument can contain literal characters, which are copied into the log file verbatim, and format specifiers, i.e. special sequences which begin with ‘%’ and are replaced in the log file as shown in the table below.

%%

The percent sign.

%a

Remote IP-address.

%A

Local IP-address.

%B

Size of response in bytes.

%b

Size of response in bytes in CLF format, i.e. a ‘-’ rather than a ‘0’ when no bytes are sent.

%C

Remote client (from the CLIENT command, see The CLIENT Command).

%D

The time taken to serve the request, in microseconds.

%d

Request command verb in abbreviated form, suitable for use in URLs, i.e. ‘d’ for DEFINE, and ‘m’ for MATCH. See DICT URL.

%h

Remote host.

%H

Request command verb (DEFINE or MATCH).

%l

Remote logname (from identd, if supplied). This will return a dash unless identity-check is set to true. See identity-check.

%m

The search strategy.

%p

The canonical port of the server serving the request.

%P

The PID of the child that served the request.

%q

The database from the request.

%r

Full request.

%{n}R

The nth token from the request (n is 0-based).

%s

Reply status. For multiple replies, the form ‘%s’ returns the status of the first reply, while ‘%>s’ returns that of the last reply.

%t

Time the request was received in the standard Apache format, e.g.:

[04/Jun/2008:11:05:22 +0300]
%{format}t

The time, in the form given by format, which should be a valid strftime format. See Time and Date Formats, for a detailed description.

The standard ‘%t’ format is equivalent to

[%d/%b/%Y:%H:%M:%S %z]
%T

The time taken to serve the request, in seconds.

%u

Remote user from AUTH command.

%v

The host name of the server serving the request. See hostname directive.

%V

Actual host name of the server (in case it was overridden in configuration).

%W

The word from the request.

For the reference, here is the list of format specifiers that have different meaning than in Apache: ‘%C’, ‘%H’, ‘%m’, ‘%q’. The following format specifiers are unique to dicod: ‘%d’, ‘%{n}R’, ‘%V’, ‘%W’.

The absence of access-log-format directive is equivalent to the following statement:

access-log-format "%h %l %u %t \"%r\" %>s %b";

It was chosen so as to be compatible with Apache access logs and be easily parsable by existing log analyzing tools, such as webalizer.

Extending this format string with the client name produces a log format similar to Apache ‘combined log’:

access-log-format "%h %l %u %t \"%r\" %>s %b \"\" \"%C\"";

Next: General Settings, Previous: Logging and Debugging, Up: Configuration   [Contents][Index]