systemd/python-systemd

JournalHandler: set journald unit

FedericoCeratto opened this issue · 2 comments

Daemons need to be able to generate logs with the same unit name configured in the systemd unit file.
JournalHandler should provide a way to do so and document it as as recommended pattern.

This can be done with:

from systemd.journal import JournalHandler

JournalHandler(SYSLOG_IDENTIFIER="unit_name")

SYSLOG_IDENTIFIER sets the syslog identifier not the unit name. Specifically filtering with journalctl -u $name is not possibly according to my tests. Am I missing something or is the example just wrong?