Search code examples
python-3.xsystemdjournal

journal.Reader loops infinitely


I would like to read my fedora log files with journal.Reader but this code :

from systemd import journal
j = journal.Reader()
j.this_boot()
j.log_level(journal.LOG_DEBUG)
# j.add_match(_BOOT_ID="0")

for entry in j:
    print(entry['MESSAGE'])

seems to loop indefinitely. I don't understand why or how to get just the current boot (_BOOT_ID=0).

Thanks


Solution

  • I had to add a match like : _TRANSPORT='kernel' and now it does what I want. :)