0

I am using unattended-upgrades on Debian 12 to run system upgrades automatically.

My problem is, that this package doesn't write logs to stdout, but to a file in /var/logs/unattended-upgrades/. That's unpractical for me.

Can I specify an input source for logs in systemd units so I can view them using journalctl?

1 Answers1

0

Journalctl doesn't support importing files. You would need a separate service that does tail -F on the log file (and has its stdout logged to the journal).

[Service]
Type=exec
ExecStart=stdbuf -o0 tail -F /var/log/whatever.log
SyslogIdentifier=upgrades

You'll need to use either journalctl -t upgrades (by syslog identifier) or journalctl -u the-forwarder – not journalctl -u unattended-upgrades – to view such logs. There is a possibility to add the OBJECT_UNIT= property to the messages so that they would show up in journalctl -u unattended-upgrades despite being logged by a different unit; but not via stdout logging – maybe through systemd-cat but likely only through a custom wrapper.

grawity
  • 17,092