I have a program that continually reads the output of:

journalctl -o json --follow

And sends it to another process. And while it outputs journal entries initially from the tail, new ones don't appear on stdout while it's running. It's as though follow mode isn't following but stalls.

So to test this, I ran up two terminal windows:

  1. journalctl -o json --follow
  2. echo "Hello world" | systemd-cat x 10 times

The first time I ran 2. it appeared to follow. Subsequent runs of 2 and nothing appears.

This is a huge problem. Follow isn't really following?

OS is Ubuntu 16.04 on x86_64

Two things might be happening:

  1. If you log the same line 10 times, duplicated lines might be filtered, try changing the hello world msg

  2. There might be some buffering between the program you use to parse the output of journalctl -f -o json and journalctl itself, see View unbuffered log output from journalctl

  • I tried both of those things. Interestingly, that doesn't occur on another machine with a systemd journal. The journalctl binary is newer. It might just be a bug. – Matt May 27 at 21:47
  • upgraded to 18.04, same issue. – Matt Jun 7 at 21:32
  • 1
    Turned out it was a corrupt /var/log/journal. Did vaccuum several times to preserve least 10 mins and it was showing events from 6 months ago so. Blew it all away then voila! – Matt Jul 14 at 1:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.