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:
journalctl -o json --follow
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
Best Answer
Two things might be happening:
If you log the same line 10 times, duplicated lines might be filtered, try changing the hello world msg
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