Heat add ability to use global logging.conf
Add ability to use global logging.conf template which can be
used in all openstack components which support oslo.log
Change-Id: Ied06bbfb63332369d22424ab5b5f0133617be835
Related-Prod: PROD-21353
diff --git a/heat/files/logging.conf b/heat/files/logging.conf
deleted file mode 100644
index f8a7f50..0000000
--- a/heat/files/logging.conf
+++ /dev/null
@@ -1,85 +0,0 @@
-{%- set log_handlers = [] -%}
-{%- for log_handler_name, log_handler_attrs in values.logging.log_handlers.items() %}
- {%- if log_handler_attrs.get('enabled', False) %}
- {%- do log_handlers.append(log_handler_name) -%}
- {%- endif %}
-{%- endfor %}
-[loggers]
-keys = root, heat, eventletwsgi
-
-[handlers]
-keys = {{ log_handlers | join(", ") }}
-
-[formatters]
-keys = context, default{% if values.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}, fluentd{% endif %}
-
-[logger_root]
-level = WARNING
-handlers = {{ log_handlers | join(", ") }}
-
-[logger_heat]
-level = INFO
-handlers = {{ log_handlers | join(", ") }}
-qualname = heat
-propagate = 0
-
-[logger_amqplib]
-level = WARNING
-handlers = {{ log_handlers | join(", ") }}
-qualname = amqplib
-
-[logger_sqlalchemy]
-level = WARNING
-handlers = {{ log_handlers | join(", ") }}
-qualname = sqlalchemy
-# "level = INFO" logs SQL queries.
-# "level = DEBUG" logs SQL queries and results.
-# "level = WARNING" logs neither. (Recommended for production systems.)
-
-[logger_boto]
-level = WARNING
-handlers = {{ log_handlers | join(", ") }}
-qualname = boto
-
-[logger_suds]
-level = INFO
-handlers = {{ log_handlers | join(", ") }}
-qualname = suds
-
-[logger_eventletwsgi]
-level = INFO
-handlers = {{ log_handlers | join(", ") }}
-qualname = eventlet.wsgi.server
-
-{%- if values.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}
-[handler_fluentd]
-class = fluent.handler.FluentHandler
-args = ('openstack.{{ service_name | replace("-", ".", 1) }}', 'localhost', 24224)
-formatter = fluentd
-{%- endif %}
-
-{%- if values.logging.log_handlers.watchedfile.enabled %}
-[handler_watchedfile]
-class = handlers.WatchedFileHandler
-args = ('/var/log/heat/{{ service_name }}.log',)
-formatter = context
-{%- endif %}
-
-{% if values.logging.log_handlers.get('ossyslog', {}).get('enabled', False) -%}
-{%- set ossyslog_args = values.logging.log_handlers.ossyslog.get('args', {}) -%}
-[handler_ossyslog]
-class = oslo_log.handlers.OSSysLogHandler
-args = ( handlers.SysLogHandler.{{ ossyslog_args.get('facility', 'LOG_USER') }}, )
-formatter = context
-{%- endif %}
-
-[formatter_context]
-class = oslo_log.formatters.ContextFormatter
-
-[formatter_default]
-format = %(message)s
-
-{%- if values.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}
-[formatter_fluentd]
-class = oslo_log.formatters.FluentFormatter
-{%- endif %}
diff --git a/heat/map.jinja b/heat/map.jinja
index d87cc97..fe301a4 100644
--- a/heat/map.jinja
+++ b/heat/map.jinja
@@ -18,6 +18,7 @@
},
'enable_proxy_headers_parsing': true,
'logging': {
+ 'app_name': 'heat',
'log_appender': false,
'log_file': '/var/log/heat/heat.log',
'log_handlers': {
@@ -38,6 +39,7 @@
},
'enable_proxy_headers_parsing': true,
'logging': {
+ 'app_name': 'heat',
'log_appender': false,
'log_file': '/var/log/heat/heat.log',
'log_handlers': {
diff --git a/heat/server.sls b/heat/server.sls
index 8d0c483..c06ac26 100644
--- a/heat/server.sls
+++ b/heat/server.sls
@@ -46,13 +46,13 @@
heat_general_logging_conf:
file.managed:
- name: /etc/heat/logging.conf
- - source: salt://heat/files/logging.conf
+ - source: salt://oslo_templates/files/logging/_logging.conf
- template: jinja
- user: heat
- group: heat
- defaults:
service_name: heat
- values: {{ server }}
+ _data: {{ server.logging }}
- require:
- pkg: heat_server_packages
{%- if server.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}
@@ -72,14 +72,14 @@
{{ service_name }}_logging_conf:
file.managed:
- name: /etc/heat/logging/logging-{{ service_name }}.conf
- - source: salt://heat/files/logging.conf
+ - source: salt://oslo_templates/files/logging/_logging.conf
- template: jinja
- makedirs: True
- user: heat
- group: heat
- defaults:
service_name: {{ service_name }}
- values: {{ server }}
+ _data: {{ server.logging }}
- require:
- pkg: heat_server_packages
{%- if server.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}