RHCSA Rapid Track
Course update
An updated version of this course is available that uses a newer version of Red Hat Enterprise Linux in the lab environment. Therefore, the RHEL 9.0 version of the lab environment will retire on December 31, 2024. Please complete any work in this lab environment before it is removed on December 31, 2024. For the most up-to-date version of this course, we recommend moving to the RHEL 9.3 version.
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
workstationmachine, log in to theserveramachine as thestudentuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$As the superuser, confirm that the
/var/log/journaldirectory does not exist. Use thelscommand to list the/var/log/journaldirectory contents. Use thesudocommand to elevate thestudentuser privileges. If prompted, use thestudentpassword.[student@servera ~]$
sudo ls /var/log/journal[sudo] password for student:studentls: cannot access '/var/log/journal': No such file or directoryBecause the
/var/log/journaldirectory does not exist, thesystemd-journaldservice does not preserve the log data after a reboot.Configure the
systemd-journaldservice on theserveramachine to preserve journals after a reboot.Create the
/var/log/journaldirectory.[student@servera ~]$
sudo mkdir /var/log/journalUncomment the
Storage=autoline in the/etc/systemd/journald.conffile, and set theStorageparameter to thepersistentvalue. You might use thesudo vim /etc/systemd/journald.confcommand to edit the configuration file. You can type/Storage=autoin thevimeditor command mode to search for theStorage=autoline....output omitted... [Journal] Storage=persistent ...output omitted...
Restart the
systemd-journaldservice to apply the configuration changes.[student@servera ~]$
sudo systemctl restart systemd-journald.service
Verify that the
systemd-journaldservice on theserveramachine preserves its journals so that they persist after a reboot.Restart the
serveramachine.[student@servera ~]$
sudo systemctl rebootConnection to servera closed by remote host. Connection to servera closed. [student@workstation ~]$The SSH connection terminates as soon as you restart the
serveramachine.Log in to the
serveramachine.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$Verify that a subdirectory with a long hexadecimal name exists in the
/var/log/journaldirectory. 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.journal63b272eae8d5443ca7aaa5593479b25fReturn to the
workstationsystem as thestudentuser.[student@servera ~]$
exitlogout Connection to servera closed.
This concludes the section.