Bitbull Tech Notes - home of free minds ...

Rotate big logs with Logrotate copytruncate

If you have servers with big logfiles and can not restart/reload/HUP service to reconfigure or rotate.
Then copytruncate is your logrotate option.

/etc/logrotate.d/openvpn

/var/log/openvpn.log {
        size 1k
        copytruncate
        compress
        compresscmd /usr/bin/bzip2
        compressext .bz2
        rotate 4
        maxage 100
}
logrotate -v /etc/logrotate.d/openvpn #dry run

logrotate -v /etc/logrotate.d/openvpn #test rotation manually

Home