systemd_kmsg_formatter (systemd v0.6.2)
Formatter wrapper for systemd's journal level information.
Journald uses log-level format similar to Linux's printk
logging function. This simply adds special prefix to the message formatted by the formatter specified via parent
option.
Automatic registration
This formatter will be automatically registered for all handlers that use logger_std_h
with type
set to one of standard_io
or standard_error
if the respective FDs point to journal that is pointed by JOURNAL_STREAM
which is autometically set by systemd if one of the options StandardOutput
or StandardError
is set to journal
. So if you are using default logger handler then all you need to do is to set
StandardOutput=journal
In your systemd.service(8)
file, and this library will handle the rest.
It is important that this formatter will still work poorly with multiline logs, if you are using such, then check out systemd_journal_h
handler (which SHOULD NOT be used with this formatter).
To disable this behaviour set auto_formatter
option for systemd
to false
.
Example
logger:add_handler(journal_stdout,
logger_std_h,
#{formatter => {systemd_kmsg_formatter, #{}}).
Options
parent
"Parent" formatter that will be used as a "main" formatter.
Defaults tologger_formatter
.
parent
with this option removed.