Logs: journalctl, /var/log, rsyslog, logrotate
Sign in to read this lesson
A server always writes down what happens — you just need to know where to look. In this lesson we learn to filter the systemd journal with journalctl, the classic files in /var/log, rsyslog, rotating logs with logrotate, and keeping the journal from filling the disk.
What you will learn
- On Ubuntu two log systems sit side by side: journald (a binary journal,
journalctl) and rsyslog (text files in/var/log/*). journalctl -u nginx -S "1 hour ago" -p warning— filters by service, time and priority;-ffollows live.- Key files:
/var/log/syslog,/var/log/auth.log(logins, sudo),/var/log/kern.log, and services' own directories. - logrotate cuts, compresses and deletes old logs daily or weekly; its settings are in
/etc/logrotate.d/. - Limit the journal's size with
SystemMaxUse=in/etc/systemd/journald.conf.d/, clean it withjournalctl --vacuum-size.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.