1
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2025-08-04 21:43:06 +02:00

replace access log ip anonymization with vars to control access logs

This commit is contained in:
Aine
2025-07-30 14:40:48 +01:00
parent 5de4b5c657
commit cbbf20004c
5 changed files with 19 additions and 21 deletions

View File

@ -159,6 +159,9 @@ matrix_client_cinny_self_check_validate_certificates: true
# See `matrix_client_cinny_config_homeserverList`. # See `matrix_client_cinny_config_homeserverList`.
matrix_client_cinny_default_hs_url: "" matrix_client_cinny_default_hs_url: ""
# Controls whether the Cinny access log is enabled
matrix_client_cinny_access_log_enabled: true
# Controls the `defaultHomeserver` value in the `config.json` file. # Controls the `defaultHomeserver` value in the `config.json` file.
matrix_client_cinny_config_defaultHomeserver: 0 # noqa var-naming matrix_client_cinny_config_defaultHomeserver: 0 # noqa var-naming

View File

@ -31,17 +31,15 @@ http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
map $remote_addr $remote_addr_anon { log_format main '$remote_addr - $remote_user [$time_local] "$request" '
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
log_format main '$remote_addr_anon - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
{% if matrix_client_cinny_access_log_enabled %}
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
{% else %}
access_log off;
{% endif %}
sendfile on; sendfile on;
#tcp_nopush on; #tcp_nopush on;

View File

@ -154,6 +154,9 @@ matrix_client_hydrogen_path_prefix: /
# Controls whether the self-check feature should validate SSL certificates. # Controls whether the self-check feature should validate SSL certificates.
matrix_client_hydrogen_self_check_validate_certificates: true matrix_client_hydrogen_self_check_validate_certificates: true
# Controls whether the access log is enabled.
matrix_client_hydrogen_access_log_enabled: true
# config.json # config.json
matrix_client_hydrogen_push: matrix_client_hydrogen_push:
appId: io.element.hydrogen.web appId: io.element.hydrogen.web

View File

@ -31,17 +31,15 @@ http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
map $remote_addr $remote_addr_anon { log_format main '$remote_addr - $remote_user [$time_local] "$request" '
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
log_format main '$remote_addr_anon - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
{% if matrix_client_hydrogen_access_log_enabled %}
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
{% else %}
access_log off;
{% endif %}
sendfile on; sendfile on;
#tcp_nopush on; #tcp_nopush on;

View File

@ -33,18 +33,14 @@ http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
map $remote_addr $remote_addr_anon { log_format main '$remote_addr - $remote_user [$time_local] "$request" '
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
log_format main '$remote_addr_anon - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
{% if matrix_synapse_reverse_proxy_companion_access_log_enabled %} {% if matrix_synapse_reverse_proxy_companion_access_log_enabled %}
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
{% else %}
access_log off;
{% endif %} {% endif %}
{% if matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled %} {% if matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled %}