nerdexam
CompTIA

XK0-006 · Question #36

A systems administrator wants to review the logs from an Apache 2 error.log file in real time and save the information to another file for later review. Which of the following commands should the…

The correct answer is D. tail -f /var/log/apache2/error.log | tee logfile.txt. Using tee allows output to be viewed in real time on the terminal while simultaneously writing it to logfile.txt. This meets both requirements: monitoring live updates and saving them for later

Troubleshooting and Diagnostics

Question

A systems administrator wants to review the logs from an Apache 2 error.log file in real time and save the information to another file for later review. Which of the following commands should the administrator use?

Options

  • Atail -f /var/log/apache2/error.log > logfile.txt
  • Btail -f /var/log/apache2/error.log | logfile.txt
  • Ctail -f /var/log/apache2/error.log >> logfile.txt
  • Dtail -f /var/log/apache2/error.log | tee logfile.txt

How the community answered

(45 responses)
  • A
    2% (1)
  • B
    7% (3)
  • C
    4% (2)
  • D
    87% (39)

Explanation

Using tee allows output to be viewed in real time on the terminal while simultaneously writing it to logfile.txt. This meets both requirements: monitoring live updates and saving them for later

Topics

#tail#tee#real-time logging#pipe redirection

Community Discussion

No community discussion yet for this question.

Full XK0-006 Practice