Merge "Cinder add ability to use global logging.conf"
diff --git a/cinder/controller.sls b/cinder/controller.sls
index 986d8d9..f094282 100644
--- a/cinder/controller.sls
+++ b/cinder/controller.sls
@@ -68,13 +68,13 @@
cinder_general_logging_conf:
file.managed:
- name: /etc/cinder/logging.conf
- - source: salt://cinder/files/logging.conf
+ - source: salt://oslo_templates/files/logging/_logging.conf
- template: jinja
- user: cinder
- group: cinder
- defaults:
service_name: cinder
- values: {{ controller }}
+ _data: {{ controller.logging }}
- require:
- pkg: cinder_controller_packages
{%- if controller.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}
@@ -96,14 +96,14 @@
{{ service_name }}_logging_conf:
file.managed:
- name: /etc/cinder/logging/logging-{{ service_name }}.conf
- - source: salt://cinder/files/logging.conf
+ - source: salt://oslo_templates/files/logging/_logging.conf
- template: jinja
- makedirs: True
- user: cinder
- group: cinder
- defaults:
service_name: {{ service_name }}
- values: {{ controller }}
+ _data: {{ controller.logging }}
- require:
- pkg: cinder_controller_packages
{%- if controller.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}
diff --git a/cinder/files/logging.conf b/cinder/files/logging.conf
deleted file mode 100644
index b979486..0000000
--- a/cinder/files/logging.conf
+++ /dev/null
@@ -1,90 +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, cinder, 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_cinder]
-level = INFO
-handlers = {{ log_handlers | join(", ") }}
-qualname = cinder
-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("-", ".") }}', 'localhost', 24224)
-formatter = fluentd
-{%- endif %}
-
-{%- if values.logging.log_handlers.watchedfile.enabled %}
-[handler_watchedfile]
-class = handlers.WatchedFileHandler
-args = ('/var/log/cinder/{{ 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
-# the OSSysLogHandler uses 'syslog' lib, where the LOG_* facilities are already *8
-# but in the context where the args are evaluated we have access only to Python's
-# handlers.SysLogHandler.LOG_* constants that _ARE_NOT_ multiplied by 8.
-# To not have a completely magic single int in the rendered template,
-# we multiply it here.
-args = ( 8 * 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/cinder/map.jinja b/cinder/map.jinja
index 1b3cb32..957f37f 100644
--- a/cinder/map.jinja
+++ b/cinder/map.jinja
@@ -29,6 +29,7 @@
'engine': None
},
'logging': {
+ 'app_name': 'cinder',
'log_appender': false,
'log_handlers': {
'watchedfile': {
@@ -59,6 +60,7 @@
'engine': None
},
'logging': {
+ 'app_name': 'cinder',
'log_appender': false,
'log_handlers': {
'watchedfile': {
@@ -91,6 +93,7 @@
'control_exchange': 'cinder'
},
'logging': {
+ 'app_name': 'cinder',
'log_appender': false,
'log_handlers': {
'watchedfile': {
@@ -119,6 +122,7 @@
'engine': None
},
'logging': {
+ 'app_name': 'cinder',
'log_appender': false,
'log_handlers': {
'watchedfile': {
diff --git a/cinder/volume.sls b/cinder/volume.sls
index c7e8276..cde53fd 100644
--- a/cinder/volume.sls
+++ b/cinder/volume.sls
@@ -130,14 +130,14 @@
{{ service_name }}_logging_conf:
file.managed:
- name: /etc/cinder/logging/logging-{{ service_name }}.conf
- - source: salt://cinder/files/logging.conf
+ - source: salt://oslo_templates/files/logging/_logging.conf
- template: jinja
- makedirs: True
- user: cinder
- group: cinder
- defaults:
service_name: {{ service_name }}
- values: {{ volume }}
+ _data: {{ volume.logging }}
- require:
- pkg: cinder_volume_packages
{%- if volume.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}