[Ansible] add upstreaminfo log format to nginx configuration #104349
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: "Writing {{ conf_d }}{{ conf_f }}"
|
||||||
|
vars:
|
||||||
|
conf_d: /etc/nginx/conf.d/
|
||||||
|
conf_f: log-format-upstreaminfo.conf
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "templates/nginx/conf.d/{{ conf_f }}"
|
||||||
|
dest: "{{ conf_d }}{{ conf_f }}"
|
||||||
|
backup: true
|
||||||
|
mode: 0664
|
||||||
|
tags:
|
||||||
|
- nginx
|
||||||
|
- config
|
||||||
|
- log_format
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
- import_tasks: tasks/copy_error_pages.yaml
|
- import_tasks: tasks/copy_error_pages.yaml
|
||||||
|
|
||||||
|
- import_tasks: common/tasks/nginx/add_upstreaminfo_log_format.yaml
|
||||||
|
|
||||||
- name: Copying nginx config
|
- name: Copying nginx config
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: templates/nginx/https.conf
|
src: templates/nginx/https.conf
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
log_format upstreaminfo
|
||||||
|
'$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" "$http_user_agent" '
|
||||||
|
'$request_length $request_time [upstream-{{ env }}-service-1234] [upstream-{{ env }}-service-1234] $upstream_addr '
|
||||||
|
'$upstream_response_length $upstream_response_time $upstream_status $request_id';
|
@ -21,7 +21,7 @@ server {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
deny all;
|
deny all;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
access_log /var/log/nginx/{{ domain }}-access.log;
|
access_log /var/log/nginx/{{ domain }}-access.log upstreaminfo;
|
||||||
error_log /var/log/nginx/{{ domain }}-error.log;
|
error_log /var/log/nginx/{{ domain }}-error.log;
|
||||||
|
|
||||||
#location /robots.txt {
|
#location /robots.txt {
|
||||||
|
Loading…
Reference in New Issue
Block a user