[sheepdog-users] logrotate

Valerio Pachera sirio81 at gmail.com
Wed Oct 8 13:18:09 CEST 2014


It seems it doesn't work but I found the workaround

copytruncate
              Truncate  the  original  log  file to zero size in place
after creating a copy, instead of moving the old log file and
optionally creating a new one.

I noticed this option in the file /etc/logrotate.d/corosync.


This is what I've done


Sheepdog daemon version 0.9.0_rc0_5_g1b4e52d

I run sheep on two hosts, one with -l rotate=debian, the other without.

On both I create /ect/logrotate.d/sheepdog

/var/lib/sheepdog/sheep.log {
        weekly
        rotate 4
        create
}

Note: I need to specify all the options so I can force the rotate.
When using --force, logrotate doesn't read the default values from
logrotate.conf.

logrotate -fv /etc/logrotate.d/sheepdog

reading config file sheepdog

Handling 1 logs

rotating pattern: /var/lib/sheepdog/sheep.log  forced from command
line (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/lib/sheepdog/sheep.log
  log needs rotating
rotating log /var/lib/sheepdog/sheep.log, log->rotateCount is 4
dateext suffix '-20141008'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/lib/sheepdog/sheep.log.4 to
/var/lib/sheepdog/sheep.log.5 (rotatecount 4, logstart 1, i 4),
old log /var/lib/sheepdog/sheep.log.4 does not exist
renaming /var/lib/sheepdog/sheep.log.3 to
/var/lib/sheepdog/sheep.log.4 (rotatecount 4, logstart 1, i 3),
old log /var/lib/sheepdog/sheep.log.3 does not exist
renaming /var/lib/sheepdog/sheep.log.2 to
/var/lib/sheepdog/sheep.log.3 (rotatecount 4, logstart 1, i 2),
old log /var/lib/sheepdog/sheep.log.2 does not exist
renaming /var/lib/sheepdog/sheep.log.1 to
/var/lib/sheepdog/sheep.log.2 (rotatecount 4, logstart 1, i 1),
renaming /var/lib/sheepdog/sheep.log.0 to
/var/lib/sheepdog/sheep.log.1 (rotatecount 4, logstart 1, i 0),
old log /var/lib/sheepdog/sheep.log.0 does not exist
log /var/lib/sheepdog/sheep.log.5 doesn't exist -- won't try to dispose of it
copying /var/lib/sheepdog/sheep.log to /var/lib/sheepdog/sheep.log.1
truncating /var/lib/sheepdog/sheep.log

root at test006:/etc/logrotate.d# ls -lh /var/lib/sheepdog/sheep.log*
-rw-r--r-- 1 root root    0 Oct  8 13:14 /var/lib/sheepdog/sheep.log
-rw-r--r-- 1 root root 139K Oct  8 13:14 /var/lib/sheepdog/sheep.log.1
-rw-r--r-- 1 root root  34K Oct  8 13:12 /var/lib/sheepdog/sheep.log.2

root at test006:/etc/logrotate.d# ls -lh /var/lib/sheepdog/sheep.log*
-rw-r--r-- 1 root root  82K Oct  8 13:14 /var/lib/sheepdog/sheep.log
-rw-r--r-- 1 root root 139K Oct  8 13:14 /var/lib/sheepdog/sheep.log.1
-rw-r--r-- 1 root root  34K Oct  8 13:12 /var/lib/sheepdog/sheep.log.2



More information about the sheepdog-users mailing list