Rotated access comparison
Compare active and rotated access logs before summarizing traffic.
Understand the pattern
Comparing current and rotated log evidence helps operators explain what they know before they change anything.
diff- Compare two text files; a difference is a meaningful nonzero status, not necessarily an execution error.
Status 1 means differences for diff; shell status must be interpreted in command context.
tail- Show the end of an input; -n selects the number of lines.
This browser lab snapshots output; it does not keep a live tail -f stream.
nl- Number input lines for a readable evidence reference.
Line numbers depend on the exact file version and numbering mode.
Worked example and expected result
$ diff /var/log/nginx-access.log /var/log/nginx-access.log.1--- /var/log/nginx-access.log +++ /var/log/nginx-access.log.1 -127.0.0.1 GET / 200 +127.0.0.1 GET /unix/ 200 -127.0.0.1 GET /assets/learn-terminal.js 200 +127.0.0.1 GET /unix/courses/ 200 -127.0.0.1 GET /api/test 404 +127.0.0.1 GET /missing 404 -127.0.0.1 POST / 405 +
Exit status: 1. This nonzero result is an expected part of this exercise.
$ tail -n 2 /var/log/nginx-access.log.1127.0.0.1 GET /unix/courses/ 200 127.0.0.1 GET /missing 404
Exit status: 0. The command completed successfully in the training fixture.
$ nl /var/log/nginx-access.log 1 127.0.0.1 GET / 200
2 127.0.0.1 GET /assets/learn-terminal.js 200
3 127.0.0.1 GET /api/test 404
4 127.0.0.1 POST / 405Exit status: 0. The command completed successfully in the training fixture.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: Incident template numberingTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.
Keep learning
- 01Config substitution previewPreview a port substitution and compare it with the unchanged source.Practice
- 02Incident template numberingNumber a runbook template so collaborators can reference exact fields.Practice
- 03Text evidence bridgeCheckpoint numbered logs, sorted comparisons, and bounded pipelines.Practice