In this exercise, you configure the system journal to preserve its data after a reboot.
Outcomes
Configure the system journal to preserve its data after a reboot.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start logs-preserve
Instructions
From the workstation machine, log in to the servera machine as the student user.
[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 the sudo command to elevate the student user privileges.
If prompted, use the student password.
[student@servera ~]$sudo ls /var/log/journal[sudo] password for student:studentls: cannot access '/var/log/journal': No such file or directory
Because the /var/log/journal directory does not exist, the systemd-journald service does not preserve the log data after a reboot.
Configure the systemd-journald service on the servera machine to preserve journals after a reboot.
Create the /var/log/journal directory.
[student@servera ~]$ sudo mkdir /var/log/journalUncomment the Storage=auto line in the /etc/systemd/journald.conf file, and set the Storage parameter to the persistent value.
You might use the sudo vim /etc/systemd/journald.conf command to edit the configuration file.
You can type /Storage=auto in the vim editor command mode to search for the Storage=auto line.
...output omitted... [Journal] Storage=persistent ...output omitted...
Restart the systemd-journald service to apply the configuration changes.
[student@servera ~]$ sudo systemctl restart systemd-journald.serviceVerify that the systemd-journald service on the servera machine preserves its journals so that they persist after a reboot.
Restart the servera machine.
[student@servera ~]$ sudo systemctl reboot
Connection to servera closed by remote host.
Connection to servera closed.
[student@workstation ~]$The SSH connection terminates as soon as you restart the servera machine.
Log in to the servera machine.
[student@workstation ~]$ ssh student@servera
...output omitted...
[student@servera ~]$Verify that a subdirectory with a long hexadecimal name exists in the /var/log/journal directory.
You can find the journal files in that directory.
The subdirectory name on your system might be different.
[student@servera ~]$sudo ls /var/log/journal[sudo] password for student:student63b272eae8d5443ca7aaa5593479b25f [student@servera ~]$sudo ls /var/log/journal/system.journal user-1000.journal63b272eae8d5443ca7aaa5593479b25f
Return to the workstation system as the student user.
[student@servera ~]$ exit
logout
Connection to servera closed.This concludes the section.