r/nginx: Configure error/access syslog separately

There may be cases where we want either error logs or access logs to be
sent to syslog, but not both.  To support these, there are now two
variables: `nginx_access_log_syslog` and `nginx_error_log_syslog`.
Both use the value of the `nginx_log_syslog` variable by default, so
existing users of the _nginx_ role will continue to work as before.
frigate-exporter
Dustin 2024-10-20 12:05:04 -05:00
parent 4ae25192d0
commit 388fd91096
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,8 @@ nginx_ssl_session_cache: shared:SSL:1m
nginx_ssl_session_timeout: 10m
nginx_ssl_ciphers: '{{ nginx_default_ssl_ciphers }}'
nginx_log_syslog: true
nginx_access_log_syslog: '{{ nginx_log_syslog }}'
nginx_error_log_syslog: '{{ nginx_log_syslog }}'
nginx_error_log_file: /var/log/nginx/error.log
nginx_access_log_file: /var/log/nginx/access.log
nginx_redirect_http_https: false

View File

@ -7,7 +7,7 @@ worker_processes auto;
{% if nginx_error_log_file %}
error_log {{ nginx_error_log_file }};
{% endif %}
{% if nginx_log_syslog|bool %}
{% if nginx_error_log_syslog|bool %}
error_log syslog:server=unix:/dev/log,facility=daemon,nohostname;
{% endif %}
pid /run/nginx.pid;
@ -27,7 +27,7 @@ http {
{% if nginx_access_log_file %}
access_log {{ nginx_access_log_file }} main;
{% endif %}
{% if nginx_log_syslog|bool %}
{% if nginx_access_log_syslog|bool %}
access_log syslog:server=unix:/dev/log,facility=daemon,nohostname main;
{% endif %}