practice task
Read Recent Logs for One Service
A service restarted during deploy and is now unhealthy. You need the recent unit logs, not every log line on the machine.
Independent study support only. No affiliation, endorsement, exam dumps, or guaranteed exam results.
Try first
journalctl -u nginx --since '30 minutes ago' --no-pager
Goal
Show recent journal entries for one systemd unit with timestamps and enough context to spot the first failure.
Expected output
Recent log lines for the nginx unit only, usually including start, reload, error, or configuration-test messages.
Teaches
Narrow logs by unit and time window so the first useful error is visible quickly.
Common mistake
Using tail on a guessed log file while the service writes its useful failure details to journald.
check your answer
Answer key
What should your command prove?
Recent log lines for the nginx unit only, usually including start, reload, error, or configuration-test messages.
How to explain it
Narrow logs by unit and time window so the first useful error is visible quickly.
What to avoid
Using tail on a guessed log file while the service writes its useful failure details to journald.
command set
Commands to know
systemctl status nginx --no-pagerjournalctl -u nginx --since '30 minutes ago' --no-pagerjournalctl -u nginx -b --no-pager
Related examples
answer check
Compare expected output
Open these command examples to compare your answer against realistic output.
next practice
Check Whether Nginx Config Is Valid
A teammate changed a server block and wants to reload nginx. You need to prove the configuration parses before touching the running service.