In this exercise, you will configure the system journal to preserve its data after a reboot.
Outcomes
You should be able to configure the system journal to preserve its data after a reboot.
Log in to workstation as student using student as the password.
On workstation, run lab log-preserve start to start the exercise.
This script ensures that the environment is set up correctly.
[student@workstation ~]$lab log-preserve start
From workstation, open an SSH session to servera as student.
[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$
As the superuser, confirm that the /var/log/journal directory does not exist.
Use the ls command to list the /var/log/journal directory contents.
Use sudo to elevate the student user privileges.
Use student as the password if asked.
[student@servera ~]$sudo ls /var/log/journal[sudo] password for student:studentls: cannot access '/var/log/journal': No such file or directory
As the /var/log/journal directory does not exist, the systemd-journald service is not preserving its log data.
Configure the systemd-journald service on servera to preserve journals across a reboot.
Uncomment the Storage=auto line in the /etc/systemd/journald.conf file and set Storage to persistent.
You may use the sudo vim /etc/systemd/journald.conf command to edit the configuration file.
Type / Storage=auto from vim command mode to search for the Storage=auto line.
...output omitted... [Journal] Storage=persistent ...output omitted...
Use the systemctl command to restart the systemd-journald service to bring the configuration changes into effect.
[student@servera ~]$sudo systemctl restart systemd-journald.service
Confirm that the systemd-journald service on servera preserves its journals such that the journals persist across reboots.
Use the systemctl reboot command to restart servera.
[student@servera ~]$sudo systemctl rebootConnection to servera closed by remote host. Connection to servera closed.[student@workstation ~]$
Notice that the SSH connection was terminated as soon as you restarted the servera system.
Open an SSH session to servera again.
[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$
Use the ls command to confirm that the /var/log/journal directory exists.
The /var/log/journal directory contains a subdirectory with a long hexadecimal name.
The journal files are found in that directory.
The subdirectory name on your system will be different.
[student@servera ~]$sudo ls /var/log/journal[sudo] password for student:student73ab164e278e48be9bf80e80714a8cd5[student@servera ~]$sudo ls \/var/log/journal/system.journal user-1000.journal73ab164e278e48be9bf80e80714a8cd5
Log out of servera.
[student@servera ~]$exitlogout Connection to servera closed.