Skip to content
Clairos Learn

Text and logs · Lesson 24 of 38 · 8 minutes

Logrotate dry run

Dry-run log rotation without moving files.

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

Junior operators build confidence by gathering evidence before changing systems.

logrotate
Inspect or dry-run a simulated log-rotation policy.

A dry run reports intended behavior without rotating real logs.

find
Search directory trees by criteria rather than relying on one shallow listing.

Quote wildcard patterns so find receives them instead of the shell expanding them first.

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.

Worked example and expected result
$ logrotate -d /etc/logrotate.d/nginx
debug: reading /etc/logrotate.d/nginx
debug: rotation pattern accepted
debug: would rotate /var/log/nginx-access.log and /var/log/nginx-error.log
/var/log/nginx-*.log {
  daily
  rotate 7
  compress
  missingok
  notifempty
}

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

$ find /var/log -name .1
/var/log/nginx-access.log.1
/var/log/nginx-error.log.1

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

$ 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.

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 “Logrotate dry run”, which interpretation is safe?

Apply it elsewhere

Before adapting the find workflow from “Logrotate dry run” to another server, what should you do?

Keep the momentum.

Complete the lab, then explain and apply the pattern.

Next: Journal time windowTry 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. 01Logrotate config reviewRead log rotation settings as text.Practice
  2. 02Journal time windowNarrow journal output before reading a whole service history.Practice
  3. 03Evidence bundleCapture a focused evidence bundle into lab notes.Practice