systemd-cat
is the equivalent to logger:
echo 'hello' | systemd-cat
In another terminal, running journalctl -f
:
Feb 07 13:38:33 localhost.localdomain cat[15162]: hello
Priorities are specified just by part of the string:
echo 'hello' | systemd-cat -p info
echo 'hello' | systemd-cat -p warning
echo 'hello' | systemd-cat -p emerg
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-descriptive local0
through local7
.
echo 'hello' | systemd-cat -t someapp -p emerg
Is logged as:
Feb 07 13:48:56 localhost.localdomain someapp[15278]: hello
As far as I know there is no such functionality in journald and I don't think it will ever be implemented.
Instead, you may implement your own journal log watcher using the python API to read the journal.
Best Answer
Forwarding messages to legacy software like syslog gives you nothing but overhead.
Instead you can implement both models using native journald features.
Push model:
(log source) systemd-journal-upload -> systemd-journal-remote (log collector)
Pull model:
(log source) systemd-journal-gatewayd <- systemd-journal-remote (log collector)
The arrow shows who initiates the connection. HTTPS is used as a transport so it's secure.
The more information can be obtained from:
http://www.freedesktop.org/software/systemd/man/systemd-journal-remote.html
http://www.freedesktop.org/software/systemd/man/systemd-journal-upload.html
and so on.