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.
command set
Commands to know
systemctl status nginx --no-pagerjournalctl -u nginx --since '30 minutes ago' --no-pagerjournalctl -u nginx -b --no-pager
Related lessons
Watch this command run
Example output from a temporary Linux lab
Read One Unit's Logs Since Boot
Review the related command card and compare your expected output with the command replay.
Watch command runSearch Logs for Failures
Review the related command card and compare your expected output with the command replay.
Watch command runnext 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.