I'm using:
Linux workdesk 3.16.0-31-generic #43~14.04.1-Ubuntu SMP Tue Mar 10 20:13:38 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
logrotate 3.8.7-1ubuntu1 amd64
I trying to test behaviour of logrotate.
my conf file is:
/home/user/test/*.log {
daily
rotate 2
ifempty
su user user
}
ls /home/user/test/*.log
outputs
/home/user/test/1.log
sudo logrotate -fv /etc/logrotate.d/r
outputs
reading config file /etc/logrotate.d/r
Handling 1 logs
rotating pattern: /home/user/test/*.log forced from command line (2 rotations)
empty log files are rotated, old logs are removed
switching euid to 1000 and egid to 1000
considering log /home/user/test/1.log
log needs rotating
rotating log /home/user/test/1.log, log->rotateCount is 2
dateext suffix '-20150327'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /home/user/test/1.log.2 to /home/user/test/1.log.3 (rotatecount 2, logstart 1, i 2),
old log /home/user/test/1.log.2 does not exist
renaming /home/user/test/1.log.1 to /home/user/test/1.log.2 (rotatecount 2, logstart 1, i 1),
old log /home/user/test/1.log.1 does not exist
renaming /home/user/test/1.log.0 to /home/user/test/1.log.1 (rotatecount 2, logstart 1, i 0),
old log /home/user/test/1.log.0 does not exist
log /home/user/test/1.log.3 doesn't exist -- won't try to dispose of it
renaming /home/user/test/1.log to /home/user/test/1.log.1
switching euid to 0 and egid to 0
and after ls
outputs
1.log.1
and that's all
Can somebody explain the rotation of process?
1) What is "renaming /home/user/test/1.log.0 to /home/user/test/1.log.1"? If I have rotate count = 0
2) Where is 1.log file?
3) where is 1.log.0? As I understand it I should get only 1.log empty file and that's all