ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 109 - XK0-005 discussion

Report
Export

A development team asks an engineer to guarantee the persistency of journal log files across system reboots. Which of the following commands would accomplish this task?

A.
grep -i auto /etc/systemd/journald.conf && systemctl restart systemd-journald.service
Answers
A.
grep -i auto /etc/systemd/journald.conf && systemctl restart systemd-journald.service
B.
cat /etc/systemd/journald.conf | awk '(print $1,$3)'
Answers
B.
cat /etc/systemd/journald.conf | awk '(print $1,$3)'
C.
sed -i 's/auto/persistent/g' /etc/systemd/journald.conf && sed -i 'persistent/s/ˆ#//q' /etc/systemd/journald.conf
Answers
C.
sed -i 's/auto/persistent/g' /etc/systemd/journald.conf && sed -i 'persistent/s/ˆ#//q' /etc/systemd/journald.conf
D.
journalctl --list-boots && systemctl restart systemd-journald.service
Answers
D.
journalctl --list-boots && systemctl restart systemd-journald.service
Suggested answer: C

Explanation:

The command sed -i 's/auto/persistent/g' /etc/systemd/journald.conf && sed -i 'persistent/s/ˆ#//q' /etc/systemd/journald.conf will accomplish the task of guaranteeing the persistency of journal log files across system reboots. The sed command is a tool for editing text files on Linux systems. The -i option modifies the file in place. The s command substitutes one string for another. The g flag replaces all occurrences of the string. The && operator executes the second command only if the first command succeeds. The q command quits after the first match. The /etc/systemd/journald.conf file is a configuration file for the systemd-journald service, which is responsible for collecting and storing log messages. The command sed -i 's/auto/persistent/g' /etc/systemd/journald.conf will replace the word auto with the word persistent in the file. This will change the value of the Storage option, which controls where the journal log files are stored. The value auto means that the journal log files are stored in the volatile memory and are lost after reboot, while the value persistent means that the journal log files are stored in the persistent storage and are preserved across reboots. The command sed -i 'persistent/s/ˆ#//q' /etc/systemd/journald.conf will remove the # character at the beginning of the line that contains the word persistent. This will uncomment the Storage option and enable it. The command sed -i 's/auto/persistent/g' /etc/systemd/journald.conf && sed -i 'persistent/s/ˆ#//q' /etc/systemd/journald.conf will guarantee the persistency of journal log files across system reboots by changing and enabling the Storage option to persistent. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not change the value of the Storage option (grep -i auto /etc/systemd/journald.conf && systemctl restart systemd-journald.service or cat /etc/systemd/journald.conf | awk '(print $1,$3)') or do not enable the Storage option (journalctl --list-boots && systemctl restart systemdjournald. service). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 16:

Managing Logging and Monitoring, page 489.

asked 02/10/2024
Mohamed Iftiquar Aslam Hameed
37 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first