intelmq icon indicating copy to clipboard operation
intelmq copied to clipboard

[1] Systemd logging

Open sebix opened this issue 9 years ago • 3 comments

python3-systemd allows simple logging to systemd:

>>> from systemd import journal
>>> log = logging.getLogger('custom_logger_name')
>>> log.propagate = False
>>> log.addHandler(journal.JournalHandler())
>>> log.error("Some message: %s", detail)

And in the journal (in red):

Sep 15 21:57:33 linux-5emk [23838]: Some message: adsa

So in the end we have something like this in the logs:

Sep 15 21:55:19 linux-5emk intelmq[23838]: file-output: INFO: Bot is starting.

sebix avatar Sep 15 '16 20:09 sebix

See also python-systemd

sebix avatar Sep 18 '16 10:09 sebix

What's the benefit over using the regular syslog?

aaronkaplan avatar Oct 05 '16 16:10 aaronkaplan

https://github.com/mosquito/cysystemd https://github.com/systemd/python-systemd/issues/68#issuecomment-487026259

ghost avatar May 11 '19 17:05 ghost