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.
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:
Same advice is on Systemd journal not showing python 3 print