1Z0-106 practice question 8 of 15

Which three statements are true about the journalctl command?

Full set: 60 questions
Answer options
A: journalctl -bl -p err fails if journal persistence is not configured.
B: journalctl -p err shows only error log level. Correct answer
C: journalctl -p notice..warning shows all messages from notice to warning log level since the last boot.
D: journalctl -k shows kernel logs since the last boot. Correct answer
E: journalctl -p 6 shows all info log level messages and above. Correct answer
Correct Answer:
B. journalctl -p err shows only error log level.; D. journalctl -k shows kernel logs since the last boot.; E. journalctl -p 6 shows all info log level messages and above.
Explanation

The journalctl command is used to query and display logs from the systemd journal. B: The -p or --priority option filters messages by a specified priority level and all levels that are more severe. Specifying -p err (priority 3) will display messages logged at the err, crit (2), alert (1), and emerg (0) levels. While the wording "only error log level" is imprecise, it is interpreted in this context as filtering based on the error level, which is correct. D: The -k or --dmesg flag is a shortcut to show only kernel messages. This option implicitly applies the -b flag, which restricts the output to messages from the current boot only. E: The -p option accepts numerical priority values. info corresponds to priority 6. Therefore, journalctl -p 6 will display all messages with a priority of 6 (info) or a more severe priority (0-5).

Why Incorrect

A. The command will not fail. The -b flag shows logs from the current boot, which are stored in memory (/run/log/journal) and are available even if persistence to /var/log/journal is not configured.
C. This command shows messages in the notice and warning priority range from all available journals. It does not limit the output to only the last boot, as the -b flag was not specified.

References

1. systemd Project

journalctl Manual Page:

For options B and E: "-p

--priority= Filter output by message priorities. ... If a single priority is specified

all messages with this or a more important priority are shown. ... The priorities are the usual syslog priorities as documented in syslog(3)

i.e. "emerg" (0)

"alert" (1)

"crit" (2)

"err" (3)

"warning" (4)

"notice" (5)

"info" (6)

"debug" (7)."

For option D: "-k

--dmesg Show only kernel messages. This implies -b and adds the match TRANSPORT=kernel."

For options A and C: "-b [[ID][±offset]]

--boot=[[ID][±offset]] Show messages from a specific boot. ... The argument may be empty

in which case logs for the current boot will be shown."

Source: freedesktop.org

journalctl(1) man page.

2. Oracle® Linux 8 Documentation

Managing Core System Configuration:

Section 12.3.2. Filtering Log Output: "To view only kernel messages

use the -k or --dmesg option. By default

this command displays kernel messages from the current boot." This supports option D.

Section 12.3.2. Filtering Log Output: "To filter output by message priority

use the -p or --priority option. You can use either the name or the corresponding number for the priority level... For example

to view only messages with a priority of error or higher

type: sudo journalctl -p err -b" This supports the functionality described in options B and E.

Source: Oracle Linux 8 Documentation

Chapter 12. Managing Log Files With journald.

Scroll to Top