Skip to content

Instantly share code, notes, and snippets.

@adaRn
Created August 15, 2019 14:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adaRn/337838d87cd8f544407d6446cf7daa80 to your computer and use it in GitHub Desktop.
Save adaRn/337838d87cd8f544407d6446cf7daa80 to your computer and use it in GitHub Desktop.
This is logrotate configuration for OpenVPN. It prevents you from huge OpenVPN log files. `copytruncate` option here is very important - OpenVPN doesn't want to close the logfile it's writing to, so this file is automatically truncated after copying its contents.
/var/log/openvpn.log {
daily
rotate 12
compress
copytruncate
delaycompress
missingok
notifempty
}
@AnrDaemon
Copy link

AnrDaemon commented Jul 7, 2022

Instead of copytruncate, tell OpenVPN to log to syslog and use syslog's facilities to redirect logging to separate files. Then you won't need to dance around deficiencies of (very basic) internal OpenVPN's logging.

Even better would be to leave openvpn logging to console and tell init daemon to capture it to syslog.
This way you won't miss the scripts output as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment