Hint for OpenVPN and monit users

Just noticed that my /var/log/openvpn.log had a size of 188 MB. This is caused by my OpenVPN monitoring (every 3 minutes) with monit:

check host openvpn with address 127.0.0.1
  start program = "/etc/init.d/openvpn start" with timeout 20 seconds
  stop  program = "/etc/init.d/openvpn stop"
  if failed port 443 type tcp with timeout 5 seconds for 2 cycles then restart
  if 4 restarts within 5 cycles then unmonitor

This leads to many

Thu Apr 19 21:41:45 2018 TCP connection established with [AF_INET]127.0.0.1:51008
Thu Apr 19 21:41:45 2018 127.0.0.1:51008 Connection reset, restarting [0]
Thu Apr 19 21:41:45 2018 127.0.0.1:51008 SIGUSR1[soft,connection-reset] received, client-instance restarting

messages in /var/log/openvpn.log, every 3 minutes.

By default OpenVPN has no logrotate - but we should enable it:

$ sudo nano /etc/logrotate.d/openvpn

/var/log/openvpn.log {
	compress
	delaycompress
	missingok
	daily
	notifempty
	rotate 2
	copytruncate
	create 600 root root
}
2 Likes

Thanks for that, had 1 gb log file lol