Update logging.conf
Change-Id: I03360c06633243ff8b8a445a3aecd6c9f86c28b5
Related-Prod: PROD-21353
diff --git a/oslo_templates/files/logging/_logging.conf b/oslo_templates/files/logging/_logging.conf
index 6c79982..6e50800 100644
--- a/oslo_templates/files/logging/_logging.conf
+++ b/oslo_templates/files/logging/_logging.conf
@@ -1,6 +1,6 @@
{%- set log_handlers = [] -%}
-{%- set app_name = _data.logging.app_name -%}
-{%- for log_handler_name, log_handler_attrs in _data.logging.log_handlers.items() %}
+{%- set app_name = _data.app_name -%}
+{%- for log_handler_name, log_handler_attrs in _data.log_handlers.items() %}
{%- if log_handler_attrs.get('enabled', False) %}
{%- do log_handlers.append(log_handler_name) -%}
{%- endif %}
@@ -13,30 +13,30 @@
keys = {{ log_handlers | join(", ") }}
[formatters]
-keys = context, default{% if _data.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}, fluentd{% endif %}
+keys = context, default{% if _data.log_handlers.get('fluentd', {}).get('enabled', False) %}, fluentd{% endif %}
[logger_root]
-level = {{ _data.logging.get('loggers', {}).get('root', {}).get('level', 'WARNING') }}
+level = {{ _data.get('loggers', {}).get('root', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
[logger_{{ app_name }}]
-level = {{ _data.logging.get('loggers', {}).get('{{ app_name }}', {}).get('level', 'INFO') }}
+level = {{ _data.get('loggers', {}).get('{{ app_name }}', {}).get('level', 'INFO') }}
handlers = {{ log_handlers | join(", ") }}
qualname = {{ app_name }}
propagate = 0
[logger_amqp]
-level = {{ _data.logging.get('loggers', {}).get('amqp', {}).get('level', 'WARNING') }}
+level = {{ _data.get('loggers', {}).get('amqp', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = amqp
[logger_amqplib]
-level = {{ _data.logging.get('loggers', {}).get('amqplib', {}).get('level', 'WARNING') }}
+level = {{ _data.get('loggers', {}).get('amqplib', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = amqplib
[logger_sqlalchemy]
-level = {{ _data.logging.get('loggers', {}).get('sqlalchemy', {}).get('level', 'WARNING') }}
+level = {{ _data.get('loggers', {}).get('sqlalchemy', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = sqlalchemy
# "level = INFO" logs SQL queries.
@@ -44,7 +44,7 @@
# "level = WARNING" logs neither. (Recommended for production systems.)
[logger_boto]
-level = {{ _data.logging.get('loggers', {}).get('boto', {}).get('level', 'WARNING') }}
+level = {{ _data.get('loggers', {}).get('boto', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = boto
@@ -52,31 +52,31 @@
# cause many extraneous log lines for their tempest runs. Refer to
# https://review.openstack.org/#/c/219225/ for details.
[logger_suds]
-level = {{ _data.logging.get('loggers', {}).get('suds', {}).get('level', 'INFO') }}
+level = {{ _data.get('loggers', {}).get('suds', {}).get('level', 'INFO') }}
handlers = {{ log_handlers | join(", ") }}
qualname = suds
[logger_eventletwsgi]
-level = {{ _data.logging.get('loggers', {}).get('eventletwsgi', {}).get('level', 'WARNING') }}
+level = {{ _data.get('loggers', {}).get('eventletwsgi', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = eventlet.wsgi.server
-{% if _data.logging.log_handlers.get('fluentd').get('enabled', False) -%}
+{% if _data.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 _data.logging.log_handlers.watchedfile.enabled -%}
+{% if _data.log_handlers.watchedfile.enabled -%}
[handler_watchedfile]
class = handlers.WatchedFileHandler
args = ('/var/log/{{ app_name }}/{{ service_name }}.log',)
formatter = context
{%- endif %}
-{% if _data.logging.log_handlers.get('ossyslog', {}).get('enabled', False) -%}
-{%- set ossyslog_args = _data.logging.log_handlers.ossyslog.get('args', {}) -%}
+{% if _data.log_handlers.get('ossyslog', {}).get('enabled', False) -%}
+{%- set ossyslog_args = _data.log_handlers.ossyslog.get('args', {}) -%}
[handler_ossyslog]
class = oslo_log.handlers.OSSysLogHandler
# the OSSysLogHandler uses 'syslog' lib, where the LOG_* facilities are already *8
@@ -94,7 +94,7 @@
[formatter_default]
format = %(message)s
-{% if _data.logging.log_handlers.get('fluentd').get('enabled', False) -%}
+{% if _data.log_handlers.get('fluentd').get('enabled', False) -%}
[formatter_fluentd]
class = oslo_log.formatters.FluentFormatter
{%- endif %}
diff --git a/tests/pillar/logging/_logging.sls b/tests/pillar/logging/_logging.sls
index 896022a..1fed559 100644
--- a/tests/pillar/logging/_logging.sls
+++ b/tests/pillar/logging/_logging.sls
@@ -1,12 +1,11 @@
_data:
- logging:
- app_name: 'nova'
- log_appender: true
- log_handlers:
- watchedfile:
- enabled: true
- fluentd:
- enabled: true
- ossyslog:
- enabled: true
+ app_name: 'nova'
+ log_appender: true
+ log_handlers:
+ watchedfile:
+ enabled: true
+ fluentd:
+ enabled: true
+ ossyslog:
+ enabled: true
service_name: nova
\ No newline at end of file