I have written a program that logs to stderr. I run it as a service with systemd. Here's the unit file:
[Unit]Description=Mi Scale TranslatorAfter=network.target[Service]Type=simpleRestart=alwaysExecStart=/root/miscale/miscale[Install]WantedBy=multi-user.targetEvery couple of days the service stops working. When I check the status this is the output:
# systemctl status miscale● miscale.service - Mi Scale Translator Loaded: loaded (/root/miscale.service; linked; vendor preset: enabled) Active: inactive (dead)I thoughtRestart=always would prevent exactly this, but apart from that there are also no logs:
# journalctl -u miscale-- Logs begin at Thu 2019-02-14 10:11:58 GMT, end at Sun 2022-12-04 20:18:38 GMT. ---- No entries --I now restarted it withsystemctl start miscale and there are logs:
# journalctl -u miscale-- Logs begin at Thu 2019-02-14 10:11:58 GMT, end at Sun 2022-12-04 20:20:31 GMT. --Dec 04 20:19:17 raspberrypi systemd[1]: Started Mi Scale Translator.But I'm sure when I check again in a few days, the service will be dead again and the logs will have disappeared.
- Maybe you have size limits for the journalctl. Check the file:
/etc/systemd/journald.confand search for the valueSystemMaxUse.Edgar Magallon– Edgar Magallon2022-12-04 20:43:50 +00:00CommentedDec 4, 2022 at 20:43 - @EdgarMagallon There's a single section
[Journal]in it and all settings includingSystemMaxUseare commented out.AndreKR– AndreKR2022-12-04 20:45:39 +00:00CommentedDec 4, 2022 at 20:45 - Don't you have a
Timer(systemd unit) or acronjob which cleans the journal logs? Something likejournalctl --vacuum-size=100Mis used to clear journal logs.Edgar Magallon– Edgar Magallon2022-12-04 20:53:45 +00:00CommentedDec 4, 2022 at 20:53 - @EdgarMagallon It's a pretty much stock Raspberry Pi OS, I didn't configure anything. Nothing in
/etc/crontabnor in/var/spool/cron.AndreKR– AndreKR2022-12-04 21:02:50 +00:00CommentedDec 4, 2022 at 21:02 - I think
Raspberrybased Linux OS are configured by default to delete logs after certain time. Or maybesystemdare deleting the logs asthis answer said orthis anwer as well.Edgar Magallon– Edgar Magallon2022-12-04 21:13:45 +00:00CommentedDec 4, 2022 at 21:13
You mustlog in to answer this question.
Explore related questions
See similar questions with these tags.
