nerdexam
CompTIA

XK0-004 · 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. The technician needs a command that follows and displays new log entries in real time during software installation. The tail -f command is the standard Linux tool for this purpose.

Troubleshooting and Diagnostics

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

(39 responses)
  • A
    3% (1)
  • B
    5% (2)
  • C
    3% (1)
  • D
    90% (35)

Why each option

The technician needs a command that follows and displays new log entries in real time during software installation. The tail -f command is the standard Linux tool for this purpose.

Acat /var/log/kern.log

The cat command reads and prints the entire file once then exits, providing no continuous or real-time monitoring capability.

Bgrep -e /var/log/httpd/access.log

The grep -e flag expects a regex pattern argument and searches static file contents for matches - it does not follow or monitor a file for new entries.

Chead -n /var/log/secure

The head -n flag displays only the first N lines of a file and exits immediately, which is the opposite of what continuous monitoring requires.

Dtail -f /var/log/messagesCorrect

The tail -f flag causes tail to follow the file, continuously outputting new lines as they are appended, which is exactly what is needed to monitor activity during an installation. The /var/log/messages file captures general system and application messages, making it a relevant target for watching third-party software behavior in real time.

Concept tested: Real-time log monitoring with tail -f

Source: https://man7.org/linux/man-pages/man1/tail.1.html

Topics

#tail -f#log monitoring#real-time logs#system logs

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice