journald: journalctl, persistent logs
Sign in to read this lesson
On RHEL the systemd journal is kept only in memory by default — when the server reboots, the whole journal is lost. To find out why a server rebooted by itself at night, the journal must be made persistent. In this lesson we do that and review RHEL's /var/log files, journalctl filters and time problems.
What you will learn
- On RHEL
Storage=auto: if/var/log/journaldoes not exist, the journal lives in/run/log/journal(RAM) and is lost on reboot. - A persistent journal:
Storage=persistentin a file in/etc/systemd/journald.conf.d/, thensystemctl restart systemd-journald. journalctl --list-bootsshows previous boots,journalctl -b -1 -p errthe previous boot's errors.- RHEL files:
/var/log/messages(general),/var/log/secure(logins, sudo),/var/log/audit/audit.log(SELinux),/var/log/cron. - Filters:
-u service,-p err,-S "1 hour ago",_PID=,_UID=,-o verbose.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.