Sub topic 14
Logs and Verifying a Server After Patching
Assume you can use a Linux shell and sudo, read systemd service status, and identify the services your server provides. This chapter focuses on evidence: records that show what changed and checks that show whether the server still works.
Find out what changed
Package managers record their actions. On Debian and Ubuntu, inspect the transaction history and package database logs:
grep -E 'Start-Date|Commandline|Upgrade:|Install:|Remove:' \
/var/log/apt/history.log
sudo grep -E ' upgrade | install | remove ' /var/log/dpkg.log | tail -50history.log groups changes into transactions. dpkg.log records lower-level package operations, including unpacking and configuration.
On RHEL-family systems, use DNF history:
sudo dnf history list
sudo dnf history info last
sudo tail -50 /var/log/dnf.logThe transaction information includes the packages installed, upgraded, or removed. Save the transaction ID before making another change if you may need to investigate or undo it.
Systemd services usually write their logs to the journal. Check a service from the time of the patch:
sudo journalctl -u nginx --since "30 minutes ago" --no-pager
sudo systemctl status nginx --no-pagerReplace nginx with the service you patched. Look for failed starts, configuration errors, permission errors, missing files, and repeated restart attempts. systemctl status gives a short current view; journalctl gives the surrounding evidence.
Verify packages, services, and access
Check that the expected package version is installed:
dpkg-query -W -f='${Package} ${Version}\n' nginx
apt-cache policy nginxOn a RHEL-family host:
rpm -q nginx
dnf info installed nginxThen verify the service and the resource it exposes:
systemctl is-active nginx
systemctl is-enabled nginx
sudo ss -ltnp | grep ':443'
curl --fail --silent --show-error --head https://localhost/is-active checks whether the service is running. is-enabled checks whether it starts through its configured boot relationship. ss shows listening TCP sockets. The curl command tests an HTTPS response locally. For a remote application, also test through its normal hostname, load balancer, or monitoring endpoint.
Check for broader system problems after a patch:
systemctl --failed
df -h
free -h
sudo journalctl -p warning..alert --since "30 minutes ago" --no-pagerA full filesystem can prevent services from writing state. Memory pressure can make a service appear to start and then stop. The priority filter shows warning-level and more serious journal messages, but inspect each message in context.
| Evidence | What it answers |
|---|---|
| Package history | Which transaction changed the host? |
| Service journal | Did a service fail or report an error? |
| Socket and endpoint checks | Can clients reach the expected service? |
| Failed-unit and resource checks | Is a wider system problem present? |
A repeatable verification flow
Record the patch time, transaction identifier, package versions, service status, endpoint result, and any warnings. This makes later comparison easier and gives the next operator a clear audit trail.
Exercise
After patching nginx, which commands would you use to inspect the transaction, read recent nginx errors, and test the local HTTPS endpoint?
Show answer
Use sudo dnf history info last or the matching APT and dpkg log commands, then sudo journalctl -u nginx --since "30 minutes ago" --no-pager, and finally curl --fail --silent --show-error --head https://localhost/.