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.
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)- B95% (18)
- D5% (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.
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.
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.
systemctl manages service state (start, stop, status) and does not display the full application log journal.
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
Community Discussion
No community discussion yet for this question.