0
0
Linux CLIscripting~20 mins

journalctl for systemd logs in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Journalctl Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this journalctl command?
You run the command journalctl -u sshd.service --since "2024-06-01 00:00:00" --until "2024-06-01 01:00:00". What does this command show?
Linux CLI
journalctl -u sshd.service --since "2024-06-01 00:00:00" --until "2024-06-01 01:00:00"
ALogs from the sshd service between midnight and 1 AM on June 1, 2024
BLogs from all services between midnight and 1 AM on June 1, 2024
CLogs from the sshd service for the entire day of June 1, 2024
DLogs from the sshd service only for June 1, 2023
Attempts:
2 left
💡 Hint
Look at the -u option for service and the --since and --until for time range.
💻 Command Output
intermediate
1:30remaining
What does this journalctl command output?
You run journalctl -p err -b. What logs are shown?
Linux CLI
journalctl -p err -b
AAll logs from the previous boot with priority error or higher
BAll logs from the current boot with priority info or lower
CAll logs from the current boot with priority error or higher
DAll logs from all boots with priority error or higher
Attempts:
2 left
💡 Hint
Check what -p and -b options mean.
🔧 Debug
advanced
2:00remaining
Why does this journalctl command fail?
You try to run journalctl --since 2024-06-01 --until 2024-06-01 23:59:59 but get an error. What is the problem?
Linux CLI
journalctl --since 2024-06-01 --until 2024-06-01 23:59:59
AThe --since date is missing the time part
BThe date format is invalid; it needs slashes instead of dashes
CThe command needs a service specified with -u
DThe --until date and time must be quoted because of the space
Attempts:
2 left
💡 Hint
Look carefully at the space in the --until argument.
🚀 Application
advanced
1:30remaining
How to show only kernel messages with journalctl?
You want to see only kernel messages from the current boot using journalctl. Which command achieves this?
Ajournalctl -k -b
Bjournalctl -u kernel -b
Cjournalctl --kernel -b
Djournalctl -p kernel -b
Attempts:
2 left
💡 Hint
Check the option for kernel messages in journalctl.
🧠 Conceptual
expert
2:00remaining
What is the effect of running journalctl --vacuum-time=2d?
You run journalctl --vacuum-time=2d. What happens to the system logs?
AOnly logs from the last 2 days are shown
BLogs older than 2 days are deleted to free disk space
CLogs are archived every 2 days
DLogs are compressed if older than 2 days
Attempts:
2 left
💡 Hint
Think about what vacuum means in journalctl context.