From 7f3cab65f03f4a66ee26f8c415947c2bdec6fb11 Mon Sep 17 00:00:00 2001 From: Graeme Seaton Date: Mon, 20 Mar 2017 19:27:24 +0000 Subject: [PATCH] Set fluentd output to elasticsearch to use elasticsearch_address Haproxy binds the elasticsearch service to kolla_internal_vip_address but the output templates for fluentd (td-agent) point to a non-existent kolla_external_vip_address. Output should also be able to be sent to an external elasticsearch instance (as per the documentation regarding overriding elasticsearch_address) Change these settings so that fluentd outputs to either the default elasticsearch_address (i.e. kolla_internal_vip_address) or to the external elasticsearch instance. Closes-Bug: #1673990 Change-Id: I081533ae8ea9aad186e9c44e1dee069729931453 --- ansible/roles/common/tasks/config.yml | 3 ++- .../common/templates/conf/output/00-local.conf.j2 | 10 ++++++---- .../roles/common/templates/conf/output/01-es.conf.j2 | 2 +- ansible/roles/common/templates/fluentd.json.j2 | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml index 1b9b1f59a4..b17f3df534 100644 --- a/ansible/roles/common/tasks/config.yml +++ b/ansible/roles/common/tasks/config.yml @@ -42,7 +42,8 @@ - name: "00-local" enabled: true - name: "01-es" - enabled: "{{ enable_elasticsearch }}" + enabled: "{{ enable_elasticsearch | bool or + ( elasticsearch_address != kolla_internal_vip_address ) | bool }}" - name: Copying over fluentd format config files template: diff --git a/ansible/roles/common/templates/conf/output/00-local.conf.j2 b/ansible/roles/common/templates/conf/output/00-local.conf.j2 index 0b2f470169..3b972d523c 100644 --- a/ansible/roles/common/templates/conf/output/00-local.conf.j2 +++ b/ansible/roles/common/templates/conf/output/00-local.conf.j2 @@ -8,10 +8,11 @@ append true compress gzip -{% if enable_elasticsearch | bool %} +{% if enable_elasticsearch | bool or + elasticsearch_address != kolla_internal_vip_address %} type elasticsearch - host {{ kolla_external_vip_address }} + host {{ elasticsearch_address }} port {{ elasticsearch_port }} logstash_format true logstash_prefix flog @@ -32,10 +33,11 @@ append true compress gzip -{% if enable_elasticsearch | bool %} +{% if enable_elasticsearch | bool or + elasticsearch_address != kolla_internal_vip_address %} type elasticsearch - host {{ kolla_external_vip_address }} + host {{ elasticsearch_address }} port {{ elasticsearch_port }} logstash_format true logstash_prefix flog diff --git a/ansible/roles/common/templates/conf/output/01-es.conf.j2 b/ansible/roles/common/templates/conf/output/01-es.conf.j2 index 2367b8a7fa..4a87fcf2fe 100644 --- a/ansible/roles/common/templates/conf/output/01-es.conf.j2 +++ b/ansible/roles/common/templates/conf/output/01-es.conf.j2 @@ -2,7 +2,7 @@ type copy type elasticsearch - host {{ kolla_external_vip_address }} + host {{ elasticsearch_address }} port {{ elasticsearch_port }} logstash_format true logstash_prefix flog diff --git a/ansible/roles/common/templates/fluentd.json.j2 b/ansible/roles/common/templates/fluentd.json.j2 index e9d6bed716..7ce3133d4e 100644 --- a/ansible/roles/common/templates/fluentd.json.j2 +++ b/ansible/roles/common/templates/fluentd.json.j2 @@ -60,7 +60,8 @@ "dest": "/etc/td-agent/format/wsgi_python.conf", "owner": "td-agent", "perm": "0600" - },{% if enable_elasticsearch | bool %} + },{% if enable_elasticsearch | bool or + ( elasticsearch_address != kolla_internal_vip_address ) | bool %} { "source": "{{ container_config_directory }}/output/01-es.conf", "dest": "/etc/td-agent/output/01-es.conf",