nerdexam
CompTIA

XK0-004 · Question #160

An administrator needs to look at a log for an application on a systemd-based system. There is no log for this application in /var/log. Which of the following is another way to view the application…

The correct answer is B. journalctl -u application. On systemd-based systems, application logs may be written to the systemd journal rather than flat files in /var/log, requiring journalctl to access them.

Troubleshooting and Diagnostics

Question

An administrator needs to look at a log for an application on a systemd-based system. There is no log for this application in /var/log. Which of the following is another way to view the application log on this system?

Options

  • Atail -f /var/log/secure
  • Bjournalctl -u application
  • Csystemctl application.service
  • Dwatch /var/lib/application/

How the community answered

(19 responses)
  • B
    95% (18)
  • D
    5% (1)

Why each option

On systemd-based systems, application logs may be written to the systemd journal rather than flat files in /var/log, requiring journalctl to access them.

Atail -f /var/log/secure

tail -f /var/log/secure streams the security and authentication log, not an application-specific log, and would not contain the target application's output.

Bjournalctl -u applicationCorrect

journalctl is the command-line tool for querying the systemd journal. The -u flag filters log output by a specific systemd unit (service), making 'journalctl -u application' the correct way to view logs for an application managed by systemd when no flat file exists in /var/log.

Csystemctl application.service

systemctl manages service state (start, stop, status) and does not display the full application log journal.

Dwatch /var/lib/application/

watch reruns a command at intervals, and /var/lib stores application state data, not log output.

Concept tested: Viewing systemd journal logs with journalctl

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

Topics

#journalctl#systemd#application logs#log management

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice