LOGGER(1) General Commands Manual LOGGER(1)


loggerSend messages to system log, or a log file


logger [-chinsv] [-d SD] [-f FILE] [-m MSGID] [-p PRIO] [-r SIZE:NUM] [-t TAG] [-u SOCK] [MESSAGE]


logger can be used to log messages to the system log daemon from a UNIX shell, or script. Optionally a stand-alone log file can be used, in which case the syslogp(3) API is still used but syslogd is bypassed. This log file can also be automatically log rotated.
Without a MESSAGE argument logger reads input from stdin.


This program follows the usual UNIX command line syntax:
Log to console (‘LOG_CONS’) if syslog() fails to send message to syslogd(8).
-d SD
Log this in the structured data (SD) field of an RFC5424 style log message. See -m for caveats. Also, please note that sd has to be passed as one argument and will require careful quoting when used from the shell.
Log file to write messages to, instead of syslog daemon. logger accepts -f- as an alias for stdout.
Log the process id of the logger process with each line (‘LOG_PID’).
The MSGID used for the message. Requires RFC5424 support in syslogd(8) for receiving the message and also for storing it properly in a log file or sending remote in correctly formatted RFC5424 style.
Open log file immediately (‘LOG_NDELAY’).
Priority, numeric or facility.severity pair.
Controls log file rotation. SIZE denotes number of bytes before rotating, default: 200 kB. NUM denotes number of rotated files to keep when logging to a file, default: 5.
Log to stderr as well as the system log.
-t TAG
Log using the specified tag, default: username.
Log to UNIX domain socket SOCK instead of the default /dev/log.
Show program version.
Log message to write. Remember to use single/double qoutes if calling logger from a shell prompt due to expansion the shell does. If no message is given logger will read from stdin until EOF. In this mode every new row (newline separated) is converted into an independent syslogp(3) call.


logger -t dropbear -p auth.notice "Successful login for user 'admin' from" 
logger -t udhcpc -f /tmp/script.log "New lease obtained for interface eth0"


If a custom log file is selected, using -f FILE, then this file is opened and written to by logger. When log file rotation is enabled, using -r SIZE:NUM, logger creates FILE.1 FILE.2 FILE.3.gz etc.
Socket used for communicating with syslogd(8). When built on BSD /var/run/log is used.


syslogp(3) syslogd(8)


logger was originally written by Joachim Wiberg to be a part of the finit(1) system monitor (PID 1), where it is called logit. It is included here to complement syslogd(8) and be extended upon in the sysklogd project.


The logger command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible, with extensions for RFC5424 from NetBSD and custom log file and log file rotation unique to the sysklogd project.
August 31, 2020 sysklogd v2.1