mod_journald Provides "journald" ErrorLog provider Extension mod_journald.c journald_module

This module provides "journald" ErrorLog provider. It allows logging error messages and CustomLog/TransferLog via systemd-journald(8).

Structured logging

Systemd-journald allows structured logging and therefore it is possible to filter logged messages according to various variables. Currently supported variables are:

LOG
The name of the log. For ErrorLog, the value is "error_log". For CustomLog or TransferLog, the value is the first argument of these directives.
REQUEST_HOSTNAME
Host, as set by full URI or Host: header in the request.
REQUEST_USER
If an authentication check was made, this gets set to the user name.
REQUEST_USERAGENT_IP
The address that originated the request.
REQUEST_URI
The path portion of the URI, or "/" if no path provided.
SERVER_HOSTNAME
The hostname of server for which the log message has been generated.

These variables can be for example used to show only log messages for particular URI using journalctl:

journalctl REQUEST_URI=/index.html -a

For more examples, see systemd-journalctl documentation.

Examples

Using journald in ErrorLog directive (see core) instead of a filename enables logging via systemd-journald(8) if the system supports it.

ErrorLog journald

Using journald as an error log provider in CustomLog directive (see mod_log_config) enables logging via systemd-journald(8) if the system supports it.

CustomLog "journald" "%h %l %u %t \"%r\" %>s %b" Performance warning

Currently, systemd-journald is not designed for high-throughput logging and logging access_log to systemd-journald could decrease the performance a lot.