Skip to content
Clairos Learn

Text and logs · Lesson 36 of 38 · 8 minutes

Rotated access comparison

Compare active and rotated access logs before summarizing traffic.

Mastery 0/3Run itExplain itApply it
learner@clairosSimulated Linux lab
learner@clairos:~ $
↑ history · Tab complete · Ctrl+C cancel · Esc, Tab to leaveExit 0

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.1
127.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 / 405

Exit status: 0. The command completed successfully in the training fixture.

Try a variation

Repeat this workflow in the sandbox with a different scratch filename. Keep the system fixtures unchanged and compare the observed output with your expectation before moving on.

Explain it

In “Rotated access comparison”, which interpretation is safe?

Apply it elsewhere

Before adapting the tail workflow from “Rotated access comparison” to another server, what should you do?

Keep the momentum.

Complete the lab, then explain and apply the pattern.

Next: Incident template numberingTry an incident drill

Anonymous 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

  1. 01Config substitution previewPreview a port substitution and compare it with the unchanged source.Practice
  2. 02Incident template numberingNumber a runbook template so collaborators can reference exact fields.Practice
  3. 03Text evidence bridgeCheckpoint numbered logs, sorted comparisons, and bounded pipelines.Practice