python-systemd icon indicating copy to clipboard operation
python-systemd copied to clipboard

Journal polling not working on Ubuntu 24.04

Open SkytAsul opened this issue 7 months ago • 1 comments

This code was working on Ubuntu 22.04, with python3-systemd version 234:

    j = systemd.journal.Reader()
    j.this_boot()
    j.log_level(systemd.journal.LOG_INFO)
    j.add_match(SYSLOG_IDENTIFIER="kernel")

    # Seek to the end of the journal to only capture new entries
    j.seek_tail()

    while True:
        if j.wait(10):
            for entry in j:
              # do things

But on Ubuntu 24.04 and python3-systemd version 235, it is not working anymore. Especially, the "for" loop does not encounter any item. If we try to run next(j) it immediately raises StopIteration, even if j.wait(timeout) returned APPEND.

I also tried the "Example: polling for journal events" code from the documentation (https://www.freedesktop.org/software/systemd/python-systemd/journal.html#example-polling-for-journal-events) and it is not working.

SkytAsul avatar Jun 18 '25 12:06 SkytAsul