Skip to content

Commit

Permalink
Enables logging to syslog if openvpn_log_file is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
elektro-wolle authored and kyl191 committed Dec 22, 2024
1 parent 41478d4 commit 1579e39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ These options change how OpenVPN itself works.
| openvpn_client_config_dir | string | | ccd | Path of `client-config-dir` |
| openvpn_client_configs | dict | | {} | Dict of settings custom client configs |

## Logrotate
## Logrotate/Syslog
Set your own custom logrotate options
| Variable | Type | Choices | Default | Comment |
|--------------------------|--------|---------|-------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| openvpn_log_dir | string | | /var/log | Set location of openvpn log files. This parameter is a part of `log-append` configuration value. |
| openvpn_log_file | string | | openvpn.log | Set log filename. This parameter is a part of `log-append` configuration value. |
| openvpn_logrotate_config | string | | rotate 4<br />weekly<br />missingok<br />notifempty<br />sharedscripts<br />copytruncate<br />delaycompress | Configure logrotate script. |
| Variable | Type | Choices | Default | Comment |
|--------------------------|--------|---------|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| openvpn_log_dir | string | | /var/log | Set location of openvpn log files. This parameter is a part of `log-append` configuration value. |
| openvpn_log_file | string | | openvpn.log | Set log filename. This parameter is a part of `log-append` configuration value. If empty, syslog is used. |
| openvpn_logrotate_config | string | | rotate 4<br />weekly<br />missingok<br />notifempty<br />sharedscripts<br />copytruncate<br />delaycompress | Configure logrotate script. |

## Packaging
This role pulls in a bunch of different packages. Override the names as necessary.
Expand Down
5 changes: 5 additions & 0 deletions templates/server.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ group {{ openvpn_service_group }}

status status-{{ openvpn_config_file }}.log
status-version {{ openvpn_status_version }}

{% if openvpn_log_file is defined %}
log-append {{ openvpn_log_dir }}/{{ openvpn_log_file }}
{% else %}
syslog openvpn
{% endif %}
verb 3

{% if openvpn_verify_cn|bool %}
Expand Down

0 comments on commit 1579e39

Please sign in to comment.