# mod_log

### MODULE

mod_log

### MODULE SUMMARY

Standard logging using the "Common Logfile Format" and text files.

### DESCRIPTION

This module makes it possible to log all incoming requests to an access log file. The de-facto standard Common Logfile Format is used for this purpose. There are numerous statistics programs available to analyze Common Logfile Format. The Common Logfile Format looks as follows:

remotehost rfc931 authuser [date] "request" status bytes

remotehost
  Remote hostname
rfc931
  The client's remote username (RFC 931).
authuser
  The username with which the user authenticated himself.
[date]
  Date and time of the request (RFC 1123).
"request"
  The request line exactly as it came from the client (RFC 1945).
status
  The HTTP status code returned to the client (RFC 1945).
bytes
  The content-length of the document transferred.

This module furthermore supports the use of an error log file to record internal server errors. The error log format is more ad hoc than Common Logfile Format, but conforms to the following syntax:

[date] access to path failed for remotehost, reason: reason

### DIRECTIVE: "ErrorLog"

Syntax: `ErrorLog` filename
Default: - None -
Module: mod_log(3)

`ErrorLog` defines the `filename` of the error log file to be used to log server errors. If the `filename` does not begin with a slash (`/`) it is assumed to be relative to the ServerRoot, for example:

    ErrorLog logs/error_log_8080

and errors will be logged in the server root (`UNIX: $SERVER_ROOT/logs/error_log_8080, Windows: %SERVER_ROOT%\logs\error_log_8080`) space.

### DIRECTIVE: "SecurityLog"

Syntax: `SecurityLog` filename
Default: - None -
Module: mod_log(3)

`SecurityLog` defines the `filename` of the access log file to be used to log security events. If the `filename` does not begin with a slash (`/`) it is assumed to be relative to the ServerRoot. For example:

    SecurityLog logs/security_log_8080

and security events will be logged in the server root (`UNIX: $SERVER_ROOT/logs/security_log_8080, Windows: %SERVER_ROOT%\logs\security_log_8080`) space.

### DIRECTIVE: "TransferLog"

Syntax: `TransferLog` filename
Default: - None -
Module: mod_log(3)

`TransferLog` defines the `filename` of the access log file to be used to log incoming requests. If the `filename` does not begin with a slash (`/`) it is assumed to be relative to the ServerRoot. For example:

    TransferLog logs/access_log_8080

and errors will be logged in the server root (`UNIX: $SERVER_ROOT/logs/access_log_8080, Windows: %SERVER_ROOT%\logs\access_log_8080`) space.

### EWSAPI MODULE INTERACTION

Uses the following EWSAPI interaction data, if available:

`{remote_user,RemoteUser}`
  as defined in mod_auth(3).

This module furthermore exports a batch of functions to be used by other EWSAPI modules:

### EXPORTS

`error_log(Socket,SocketType,ConfigDB,Date,Reason) -> ok | no_error_log`

Types:

`Socket = socket()`
`SocketType = ip_comm | ssl`
`ConfigDB = config_db()`
`Date = Reason = string()`

`error_log/5` logs an error in a log file. `Socket` is a handler to a socket of type `SocketType` and `config_db()` is the server config file in ETS table format as described in httpd(3). `Date` is a RFC 1123 date string as generated by httpd_util:rfc1123_date/0.

### SEE ALSO

httpd(3), mod_auth(3), mod_security(3), mod_disk_log(3)

### AUTHORS

Joakim Grebenö - support@erlang.ericsson.se

inets 4.2
Copyright © 1991-2005 Ericsson AB