On systemd 201 (f18) and 204 (rawhide), the attached toy program loops for quite a while, consuming journald entries immediately after it did an sd_journal_seek_tail(), to go to the last entry. It's as though the tail sought is not the real final entry (systemwide), though not the head either. % cat sample.c #include <systemd/sd-journal.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> void main(int argc, char *argv[]) { sd_journal* journald_context; int count; int rc; rc = sd_journal_open(& journald_context, 0); assert (rc == 0); if (argc == 2 && !strcmp(argv[1],"tail")) rc = sd_journal_seek_tail(journald_context); else if (argc == 2 && !strcmp(argv[1],"head")) rc = sd_journal_seek_head(journald_context); else rc = 0; assert (rc == 0); for (count=0 ; ; count++) { char *cursor; rc = sd_journal_next(journald_context); assert (rc >= 0); if (rc == 0) break; rc = sd_journal_get_cursor(journald_context, &cursor); assert (rc == 0); printf ("#%d: cursor %s\n", count, cursor); free (cursor); } } % gcc sample.c -lsystemd-journal % a.out head | wc -l --- expecting this to be a large number; on my f18 workstation, 189350 % a.out tail | wc -l --- expecting this to be near-zero; on my f18 workstation, 188492
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle. Changing version to '20'. More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20
I found that adding a sd_journal_previous_skip (..., 1) call after the sd_journal_seek_tail (like journalctl -f does) makes things work. It would be nice if this workaround were not necessary (or else documented).
The sd_journal_seek_tail() works as expected with systemd-208-11.el7.x86_64, but does not work with systemd-208-19.fc20.x86_64 and systemd-214-4.fc21.x86_64.
This message is a reminder that Fedora 20 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 20. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '20'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 20 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle. Changing version to '23'. (As we did not run this process for some time, it could affect also pre-Fedora 23 development cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.) More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
This is fixed on F23. $ ./a.out head | wc -l 809933 $ ./a.out tail | wc -l 56 $ rpm -q systemd systemd-222-7.fc23.x86_64