Enable default nginx paths on hosts where nginx is running

The nginx module setup in filebeat currently only looks for nginx
logs within containers. This commit also enables the default nginx
log paths (/var/log/nginx/*.log) when nginx is running directly on
the physical host. This allows e.g. filebeat to access nginx logs
from Kibana when kibana is not running in an openstack container.

Change-Id: Ieec4c185206a0d1d44e04d1667a6ecdfd18bb46e
This commit is contained in:
Duncan Martin Walker 2020-03-13 12:31:04 +00:00
parent 2a40936187
commit a4181c96ae
2 changed files with 8 additions and 0 deletions

View File

@ -84,6 +84,7 @@
logstash_enabled: "{{ ((ansible_facts.services['logstash.service'] | default({}) )['state'] | default('')) == 'running' }}"
kibana_enabled: "{{ ((ansible_facts.services['kibana.service'] | default({}) )['state'] | default('')) == 'running' }}"
haproxy_enabled: "{{ ((ansible_facts.services['haproxy.service'] | default({}) )['state'] | default('')) == 'running' }}"
nginx_enabled: "{{ ((ansible_facts.services['nginx.service'] | default({}) )['state'] | default('')) == 'running' }}"
- name: Drop Filebeat conf file
template:

View File

@ -324,6 +324,10 @@ filebeat.modules:
var.paths:
- /openstack/log/*repo_container*/nginx/*access.log
- /openstack/log/*keystone*/nginx/*access.log
{% if (nginx_enabled | default(false) | bool ) %}
- var/log/nginx/*access.log
{% endif %}
# Input configuration (advanced). Any input configuration option
# can be added under this section.
#input:
@ -340,6 +344,9 @@ filebeat.modules:
var.paths:
- /openstack/log/*repo_container*/nginx/*error.log
- /openstack/log/*keystone*/nginx/*error.log
{% if (nginx_enabled | default(false) | bool ) %}
- var/log/nginx/*error.log
{% endif %}
# Input configuration (advanced). Any input configuration option
# can be added under this section.