-
Where can I add the access log format? Prompt me, please. - name: Configure NGINX
ansible.builtin.include_role:
name: nginxinc.nginx_config
vars:
nginx_config_debug_output: true
...
template_file: nginx.conf.j2
deployment_location: /etc/nginx/nginx.conf
...
http:
log:
format:
- name: main
format: |
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
include:
- /etc/nginx/conf.d/*.conf
- /etc/nginx/conf.d/backend/*.conf |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Did you try putting |
Beta Was this translation helpful? Give feedback.
-
Did you try using the |
Beta Was this translation helpful? Give feedback.
-
It looks like the template nginx.conf.j2 doesn't have the necessary code to build a global format log section inside nginx.conf |
Beta Was this translation helpful? Give feedback.
You can only use logs within the
http
andstream
contexts 😄