The application log /var/log/lab-rotate/app.log has grown, and a rotation rule was written for it. A colleague ran logrotate with the --debug option "to see the details" and is sure the rotation happened. Repeat after them and compare the directory before and after.
Rotation with --debug
You are in /srv/rotate-lab. Look at the log directory, run logrotate the way your colleague did, and look at the directory again.
First, predict
logrotate will print log needs rotating and renaming /var/log/lab-rotate/app.log to /var/log/lab-rotate/app.log.1. What will the directory hold after the command?
Now start the exercise, run the command and compare your prediction with the output.
Why did logrotate describe renaming app.log, while the files in the directory did not change?
-
logrotate printed
log needs rotating: 2048 bytes is over thesize 1kthreshold. -
The timer runs logrotate with the system rules in
/etc/logrotate.d. The rule in/srv/rotate-labis not among them. -
The command ran through
sudo, and the output has no permission errors. On its first line logrotate itself says it does nothing in debug mode.
--debug only showed the rotation plan, as logrotate warned on its first line.