---
name: "mod_disk_log"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:10.b.1a-1"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/mod_disk_log"
---

# mod\_disk\_log(3erl)

Standard logging using the "Common Logfile Format" and disk\_log(3).

## NAME

mod\_disk\_log - Standard logging using the "Common Logfile Format" and disk\_log(3).

## DESCRIPTION

This module uses *disk\_log(3)* to make 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 statistic programs available to analyze Common Logfile Format log files. The Common Logfile Format looks as follows:

*remotehost rfc931 authuser \[date\] "request" status bytes*

- ***remotehost*:**

  Remote hostname (or IP number if the DNS hostname is not available).

- ***rfc931*:**

  The client's remote username (RFC 931).

- ***authuser*:**

  The username with which the user has 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 uses *disk\_log(3)* to support 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: DiskLogFormat

*Syntax:* *DiskLogFormat* internal\|external\
\
  *Default:* - external -\
\
  *Module:* mod\_disk\_log(3)

*DiskLogFormat* defines the file-format of the log files see *disk\_log* for more information. If the internal file-format is used, the logfile will be repaired after a crash. When a log file is repaired data might get lost. When the external file-format is used httpd will not start if the log file is broken.

```
      DiskLogFormat external
```

## DIRECTIVE: ErrorDiskLog

*Syntax:* *ErrorDiskLog* filename\
\
  *Default:* - None -\
\
  *Module:* mod\_disk\_log(3)

*ErrorDiskLog* defines the *filename* of the *(disk\_log(3))* 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:

```
ErrorDiskLog logs/error_disk_log_8080
```

and errors will be logged in the server root($SERVER\_ROOT/logs/error\_disk\_log\_8080) space.

## DIRECTIVE: ErrorDiskLogSize

*Syntax:* *ErrorDiskLogSize* max-bytes max-files\
\
  *Default:* *ErrorDiskLogSize 512000 8*\
\
  *Module:* mod\_disk\_log(3)

*ErrorDiskLogSize* defines the properties of the *(disk\_log(3))* error log file. The *disk\_log(3)* error log file is of type *wrap log* and *max-bytes* will be written to each file and *max-files* will be used before the first file is truncated and reused.

## DIRECTIVE: SecurityDiskLog

*Syntax:* *SecurityDiskLog* filename\
\
  *Default:* - None -\
\
  *Module:* mod\_disk\_log(3)

*SecurityDiskLog* defines the *filename* of the *(disk\_log(3))* access log file which logs incoming security events i.e authenticated requests. If the *filename* does not begin with a slash (*/*) it is assumed to be relative to the ServerRoot, see TransferDiskLog for more information.

## DIRECTIVE: SecurityDiskLogSize

*Syntax:* *SecurityDiskLogSize* max-bytes max-files\
\
  *Default:* *SecurityDiskLogSize 512000 8*\
\
  *Module:* mod\_disk\_log(3)

*SecurityDiskLogSize* defines the properties of the *disk\_log(3)* access log file. The *disk\_log(3)* access log file is of type *wrap log* and *max-bytes* will be written to each file and *max-files* will be used before the first file is truncated and reused.

## DIRECTIVE: TransferDiskLog

*Syntax:* *TransferDiskLog* filename\
\
  *Default:* - None -\
\
  *Module:* mod\_disk\_log(3)

*TransferDiskLog* defines the *filename* of the *(disk\_log(3))* access log file which logs incoming requests. If the *filename* does not begin with a slash (*/*) it is assumed to be relative to the ServerRoot, for example:

```
TransferDiskLog logs/transfer_disk_log_8080
```

and errors will be logged in the server root($SERVER\_ROOT/logs/transfer\_disk\_log\_8080) space.

## DIRECTIVE: TransferDiskLogSize

*Syntax:* *TransferDiskLogSize* max-bytes max-files\
\
  *Default:* *TransferDiskLogSize 512000 8*\
\
  *Module:* mod\_disk\_log(3)

*TransferDiskLogSize* defines the properties of the *disk\_log(3)* access log file. The *disk\_log(3)* access log file is of type *wrap log* and *max-bytes* will be written to each file and *max-files* will be used before the first file is truncated and reused.

## 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* uses *disk\_log(3)* to log an error in the error 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.

**security\_log(User,Event) -\> ok \| no\_security\_log**\

- Types

  User = String()\
   Event = String\

*security\_log/2* uses *disk\_log(3)* to log a security event in the security log file. *User* is the users name.

## SEE ALSO

httpd(3), mod\_auth(3), mod\_security(3), mod\_log(3)

## AUTHOR

```
Joakim Grebenö  - support@erlang.ericsson.se
```
