I have several systemd services defined. They log both to disk and also to the systemd journal, which I can monitor using journalctl -n 0 -fu myservice. However, I notice that the logs that I see from the journalctl tail command are often several minutes behind the disk logs. I've confirmed that this is not related to the actual logging configuration used by the daemon, as when I run the daemon manually and it's outputting its logs to standard output on a console, I see the logs immediately.

How can I see log output from journalctl immediately as the service generates it? Either completely unbuffered, or line buffered would be acceptable.

  • i'm beginning to think that this is not an issue between the service and journald, nor to do with if it's python or java or whatever, but maybe journalctl which seems to follow for a few seconds and then stops. digging deeper before I either answer or file a bug. My initial experiments are between using StandardOutput=file:/somepath and tailing that, or using journalctl -n 0 -fu myservice
    – mike
    Jul 14, 2018 at 1:25

1 Answer 1


Maybe it is a pipe between your daemon and systemd used for logging which is buffered? Possibly this is a duplicate of Output of a python script running as unit is out of order while shells seems unnafected where advice is:

Adding sys.stdout.flush() after write or PYTHONUNBUFFERED environment will solve this problem

Same advice is on Systemd journal not showing python 3 print

  • Not actively using this code any longer but it was a Java service using slf4j and logback. There was no shell wrapper.
    – amoe
    Jan 9, 2018 at 22:21
  • If it is this issue, Java might have similar way of flushing stdout/stderr: stackoverflow.com/questions/12945736/…
    – jhutar
    Jan 9, 2018 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .