LOGGER(1) User Commands LOGGER(1)
logger – enter messages into the system log
logger [options] [message]
logger makes entries in the system log.
When the optional message argument is present, it is written to the
log. If it is not present, and the -f option is not given either, then
standard input is logged.
Use datagrams (UDP) only. By default the connection is tried to
the syslog port defined in /etc/services, which is often 514 .
When processing files, empty lines will be ignored. An empty
line is defined to be a line without any characters. Thus a line
consisting only of whitespace is NOT considered empty. Note
that when the –prio-prefix option is specified, the priority is
not part of the line. Thus an empty line in this mode is a line
that does not have any characters after the priority (e.g.
-f, –file file
Log the contents of the specified file. This option cannot be
combined with a command-line message.
-i Log the PID of the logger process with each line.
Log the PID of the logger process with each line. When the
optional argument id is specified, then it is used instead of
the logger command’s PID. The use of –id=$$ (PPID) is recom‐
mended in scripts that send several messages.
Write a systemd journal entry. The entry is read from the given
file, when specified, otherwise from standard input. Each line
must begin with a field that is accepted by journald; see sys‐
temd.journal-fields(7) for details. The use of a MESSAGE_ID
field is generally a good idea, as it makes finding entries
logger –journald <
If the prefix contains no facility, the facility defaults to
what is specified by the -p option. Similarly, if no prefix is
provided, the line is logged using the priority given with -p.
This option doesn’t affect a command-line message.
Use the RFC 3164 BSD syslog protocol to submit messages to a
Use the RFC 5424 syslog protocol to submit messages to a remote
server. The optional without argument can be a comma-separated
list of the following values: notq, notime, nohost. The notq
value suppresses the time-quality structured data from the sub‐
mitted message. (The time-quality information shows whether the
local clock was synchronized plus the maximum number of
microseconds the timestamp might be off.) The notime value
(which implies notq) suppresses the complete sender timestamp
that is in ISO-8601 format, including microseconds and timezone.
The nohost value suppresses gethostname information from the
The RFC 5424 protocol has been the default for logger since ver‐
Use the RFC 6587 octet counting framing method for sending mes‐
sages. When this option is not used, the default is no framing
on UDP, and RFC6587 non-transparent-framing (also known as octet
stuffing) on TCP.
Output the message to standard error as well as to the system
Use stream (TCP) only. By default the connection is tried to
the syslog-conn port defined in /etc/services, which is often
-t, –tag tag
Mark every line to be logged with the specified tag.
-u, –socket socket
Write to the specified socket instead of to the system log
Print errors about Unix socket connections. The mode can be a
value of off, on, or auto. When the mode is auto logger will
detect if the init process is systemd, and if so assumption is
made /dev/log can be used early at boot. Other init systems
lack of /dev/log will not cause errors that is identical with
messaging using openlog(3) system call. The logger before
version 2.26 used openlog, and hence was inable to detected loss
of messages sent to Unix sockets.
The default mode is auto. When errors are not enabled lost mes‐
sages are not communicated and will result to successful return
value of logger invocation.
— End the argument list. This allows the message to start with a
Display version information and exit.
Display help text and exit.
The logger utility exits 0 on success, and >0 if an error occurs.
FACILITIES AND LEVELS
Valid facility names are:
authpriv for security information of a sensitive nature
kern cannot be generated from userspace process, automatically converted to user
security deprecated synonym for auth
Valid level names are:
panic deprecated synonym for emerg
error deprecated synonym for err
warn deprecated synonym for warning
For the priority order and intended purposes of these facilities and
levels, see syslog(3).
logger System rebooted
logger -p local0.notice -t HOSTIDM -f /dev/idmc
logger -n loghost.example.com System rebooted
syslog(3), journalctl, systemd.journal-fields(7)
The logger command is expected to be IEEE Std 1003.2 (“POSIX.2”) com‐
The logger command is part of the util-linux package and is available
from Linux Kernel Archive ⟨ftp://ftp.kernel.org/pub/linux/utils/util-
util-linux March 2015 LOGGER(1)