I'm having a systemd service defined as follows, that works fine:
[Unit] Description=my service After=network.target [Service] User=myuser Group=mygroup WorkingDirectory=/home/myuser/myapp Environment="PATH=/home/myuser/myapp/.venv/bin" ExecStart=/home/myuser/myapp/.venv/bin/python3 /home/myuser/myapp/run.py Restart=on-failure [Install] WantedBy=multi-user.target
This is a Python web application based on Flask framework. Normally in the stdout of the application I can see incoming requests "live", I mean when I run the app like
Now after starting the service I'd like to follow logs of the app and I do:
sudo journalctl -f -u my_app.service
and incoming logs are awfully slow - sometimes it takes minutes or more for them to appear in logs. Afterwards they all have proper timestamp though, so it's not like they're disappearing, they do, but after a long time.
What I've tried:
to redirect systemd service output to files:
with no luck - they save fine but with the same slow speed
to try to dump journalctl logs to offline faster setting
5s- didn't help either
Is there any way to pass those logs faster from my application to journald? I don't have troubles with other services like system authentication ones - I see records immediately.
journald.conf file has default parameters (except one above), my systemd is version 237 and I'm running Ubuntu 18.04.