XK0-005 · Question #311
While installing third-party software, a technician wants to monitor logs on the system continuously. Which of the following commands should the technician issue to monitor the logs?
The correct answer is D. tail -f /var/log/messages. To continuously monitor log files as new entries are added, the tail -f command is the appropriate choice, as it displays the last part of a file and then follows its growth.
Question
While installing third-party software, a technician wants to monitor logs on the system continuously. Which of the following commands should the technician issue to monitor the logs?
Options
- Acat /var/log/kern.log
- Bgrep -e /var/log/httpd/access.log
- Chead -n /var/log/secure
- Dtail -f /var/log/messages
How the community answered
(30 responses)- A3% (1)
- B7% (2)
- D90% (27)
Why each option
To continuously monitor log files as new entries are added, the `tail -f` command is the appropriate choice, as it displays the last part of a file and then follows its growth.
The `cat /var/log/kern.log` command displays the entire content of the `kern.log` file at once and then exits, making it unsuitable for continuous monitoring of new entries.
The `grep -e /var/log/httpd/access.log` command is syntactically incorrect; `grep` expects a pattern as an argument, not just a file, and it does not continuously monitor a file for new entries.
The `head -n /var/log/secure` command displays only the first `n` lines of the `secure` log file and then exits, which is not suitable for continuous monitoring of new entries.
The `tail -f /var/log/messages` command displays the last lines of the `/var/log/messages` file and then continuously outputs new lines as they are appended to the file. The `-f` option (follow) is essential for real-time monitoring of logs during an installation or operation.
Concept tested: Real-time log file monitoring
Source: https://man7.org/linux/man-pages/man1/tail.1.html
Topics
Community Discussion
No community discussion yet for this question.