From 2f878e6cf7e2198817cae88039a15f13e5dd6012 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Thu, 28 Jun 2018 16:35:08 -0500 Subject: [PATCH] Dynamically generate tags for oslo_log fluentd formatter This proposes changing the tags added to the openstack logs gathered by the fluentd handler from `openstack.` to `Namespace.Release` to account for multiple instances of openstack services being deployed into different namespaces. This allows for fine tuning the search queries in elasticsearch/kibana to target specific service deployments in specific namespaces Change-Id: Ia12dceb4089e107e15d8e30c92c91f350dc31318 --- barbican/templates/configmap-etc.yaml | 2 +- cinder/templates/configmap-etc.yaml | 2 +- congress/templates/configmap-etc.yaml | 2 +- glance/templates/configmap-etc.yaml | 2 +- heat/templates/configmap-etc.yaml | 2 +- ironic/templates/configmap-etc.yaml | 2 +- keystone/templates/configmap-etc.yaml | 2 +- magnum/templates/configmap-etc.yaml | 2 +- mistral/templates/configmap-etc.yaml | 2 +- neutron/templates/configmap-etc.yaml | 2 +- nova/templates/configmap-etc.yaml | 2 +- senlin/templates/configmap-etc.yaml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/barbican/templates/configmap-etc.yaml b/barbican/templates/configmap-etc.yaml index 791404ca74..b0bc11370f 100644 --- a/barbican/templates/configmap-etc.yaml +++ b/barbican/templates/configmap-etc.yaml @@ -75,7 +75,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.barbican', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/cinder/templates/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index 5902360f3b..e116bdede1 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -97,7 +97,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.cinder', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/congress/templates/configmap-etc.yaml b/congress/templates/configmap-etc.yaml index 67449f2c52..0996efd7d6 100644 --- a/congress/templates/configmap-etc.yaml +++ b/congress/templates/configmap-etc.yaml @@ -66,7 +66,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.congress', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/glance/templates/configmap-etc.yaml b/glance/templates/configmap-etc.yaml index a2541e91cc..c3d2f72355 100644 --- a/glance/templates/configmap-etc.yaml +++ b/glance/templates/configmap-etc.yaml @@ -147,7 +147,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.glance', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/heat/templates/configmap-etc.yaml b/heat/templates/configmap-etc.yaml index 59c10ced19..7d565282aa 100644 --- a/heat/templates/configmap-etc.yaml +++ b/heat/templates/configmap-etc.yaml @@ -123,7 +123,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.heat', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/ironic/templates/configmap-etc.yaml b/ironic/templates/configmap-etc.yaml index 74d3c16b23..d0a62d5a4d 100644 --- a/ironic/templates/configmap-etc.yaml +++ b/ironic/templates/configmap-etc.yaml @@ -187,7 +187,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.ironic', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/keystone/templates/configmap-etc.yaml b/keystone/templates/configmap-etc.yaml index edbe3fbf92..56359ea8ca 100644 --- a/keystone/templates/configmap-etc.yaml +++ b/keystone/templates/configmap-etc.yaml @@ -32,7 +32,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.keystone', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/magnum/templates/configmap-etc.yaml b/magnum/templates/configmap-etc.yaml index 19c7d9a1d6..677abfce51 100644 --- a/magnum/templates/configmap-etc.yaml +++ b/magnum/templates/configmap-etc.yaml @@ -76,7 +76,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.magnum', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/mistral/templates/configmap-etc.yaml b/mistral/templates/configmap-etc.yaml index f367b10b91..133cce3662 100644 --- a/mistral/templates/configmap-etc.yaml +++ b/mistral/templates/configmap-etc.yaml @@ -66,7 +66,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.mistral', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml index 88a26c9871..ffed59c8a0 100644 --- a/neutron/templates/configmap-etc.yaml +++ b/neutron/templates/configmap-etc.yaml @@ -160,7 +160,7 @@ just set it along with nova_metadata_host. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.neutron', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/nova/templates/configmap-etc.yaml b/nova/templates/configmap-etc.yaml index ea70c13827..f1c2ebb4b3 100644 --- a/nova/templates/configmap-etc.yaml +++ b/nova/templates/configmap-etc.yaml @@ -203,7 +203,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.nova', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}} diff --git a/senlin/templates/configmap-etc.yaml b/senlin/templates/configmap-etc.yaml index 6eb648bddf..cf9477ae5f 100644 --- a/senlin/templates/configmap-etc.yaml +++ b/senlin/templates/configmap-etc.yaml @@ -86,7 +86,7 @@ limitations under the License. {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluent_args := printf "('openstack.senlin', '%s', %s)" $fluentd_host $fluentd_port }} +{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }} {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} {{- end -}}