My OpenVPN server crashed everyday :'(. I have no idea why it crashed, I tried to read the log but I figured out that the log grown to 2GB whenever it crahsed XX( The log files is just too hugh to inspect.
I guess the root cause is the file size of the log file crashed the server. Luckily I have enabled incoming SSH access to fix this remotely.
So I just wrote couple lines in a shell script and made a scheduled job to truncate and backup the log file to prevent further issue.
Update Aug 4 2009
Yes it is indeed the root cause crashing the OpenVPN server. The script here works and prevent the VPN server crash again.
1. Login as root. Create a shell script /opt/etc/openvpn/jail/log/archivelog
#!/opt/bin/bash logpath='/opt/etc/openvpn/jail/log' datestamp=`date '+%Y%m%d%H%M%S'` tar cvf $logpath/openvpn.log.$datestamp.tar $logpath/openvpn.log gzip $logpath/openvpn.log.$datestamp.tar echo '' > $logpath/openvpn.log
2. Make the script executable
# chmod 700 /opt/etc/openvpn/jail/log/archivelog
3. Add an entry in /etc/crontab, add a job to execute the archivelog script per hour
#minute hour mday month wday who command 30 * * * * root /opt/bin/bash /opt/etc/openvpn/jail/log/archivelog
4. restart cron
# /usr/syno/etc/rc.d/S04crond.sh stop # /usr/syno/etc/rc.d/S04crond.sh start