I moved logging for openvpn
into its own log and attempted to set up log rotation for it, but I've obviously done something wrong.
Logging occurs as desired but always into the 2nd logfileopenvpn.log.1
. The 'current' logfile openvpn.log
exists, but is always empty.
-rw------- 1 root root 0 Apr 20 07:35 openvpn.log
-rw------- 1 root root 5411 Apr 20 07:58 openvpn.log.1
Here's my logrotate configuration file for openvpn.
/var/log/openvpn.log {
daily
rotate 7
delaycompress
compress
notifempty
missingok
}
The line in Openvpn's server.conf
regarding logging is
log-append /var/log/openvpn.log
What did I mess up?
According to this old post on the openvpn-users mailing list :
So the solution is to use the
copytruncate
option in the logrotate configuration:This is what I have in my
/etc/logrotate.d/openvpn
file :You should make your service aware of log rotation. Some services may be killed with HUP signal some may need a full restart. It is possible that service opens the
openvpn.log
file, which is renamed toopenvpn.log.1
.Try to add:
I don't know exactly how your service is called, so my guess for
openvpn.service
may be wrong.