diff --git a/defaults/main.yml b/defaults/main.yml index 34c43ef..c26c140 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -68,3 +68,7 @@ nginx_upstreams: [] # "srv2.example.com weight=3", # "srv3.example.com" # } +nginx_log_format: | + '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"' diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 38bf0cd..2d8d692 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -22,9 +22,7 @@ http { client_max_body_size {{ nginx_client_max_body_size }}; - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; + log_format main {{ nginx_log_format|indent(23) }}; access_log {{ nginx_access_log }};