Lighttpd
上QQ阅读APP看书,第一时间看更新

Access Logging

We can configure logging to include more or less information. By default, Lighttpd uses the Common Log Format (CLF) as used by most available HTTP servers with varying extensions. However, the access logging is completely configurable.

If we do not care about logging, or, we are really strapped for disk space (for example, on embedded systems) we can turn it off entirely by removing mod_accesslog from our server.modules (on embedded systems we would go one step further and remove mod_accesslog entirely). Otherwise, we can configure logging to strike a balance between space and use privacy requirements on one hand, and our interest in the data on the other hand.

The access.log file follows a format laid out in the accesslog.format configuration option. The contents of this option are included as plain text on each line, but only for entries starting with a percent sign. These entries are placeholders for information about the logged event. Here is a list of these placeholders:

The default for accesslog.format is "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" in compliance with the CLF. The other configuration options of mod_accesslog allow us to use a syslog daemon for logging or specifying an alternative file path for the access log:

# either
accesslog.use-syslog = "enable"
# or
accesslog.filename = "/var/log/lighttpd.log"