In older Linux systems, the logger
command can be used to send a log message to syslog.
Reading where does logger
log its messages to in Arch Linux?, it seems that syslog
messages and the logger
command line app only talk to the systemd
journal if a socket for message forwarding is set up.
So what's the modern equivalent of the logger
command? How can I send a message directly to the systemd journal from the command line?
Best Answer
systemd-cat
is the equivalent to logger:In another terminal, running
journalctl -f
:Priorities are specified just by part of the string:
Warnings are bold, emergencies are bold and red. Scary stuff.
You can also use an 'identifier' which is arbitrary, to specify the app name. These are like syslog's old facilities, but you're not stuck with ancient things like
lpr
uucp
nntp
or the ever-descriptivelocal0
throughlocal7
.Is logged as: