Merge "Add support of OSSysLogHandler logging handler"
diff --git a/README.rst b/README.rst
index 414df49..8503acb 100644
--- a/README.rst
+++ b/README.rst
@@ -219,8 +219,9 @@
 That is possible to enable per-binary logging.conf with new variables:
   * openstack_log_appender - set it to true to enable log_config_append for all OpenStack services;
   * openstack_fluentd_handler_enabled - set to true to enable FluentHandler for all Openstack services.
+  * openstack_ossyslog_handler_enabled - set to true to enable OSSysLogHandler for all Openstack services.
 
-Only WatchedFileHandler and FluentHandler are available.
+Only WatchedFileHandler, OSSysLogHandler and FluentHandler are available.
 
 Also it is possible to configure this with pillar:
 
@@ -235,7 +236,8 @@
             enabled: true
           fluentd:
             enabled: true
-
+          ossyslog:
+            enabled: true
 
 Documentation and Bugs
 ======================
diff --git a/heat/files/logging.conf b/heat/files/logging.conf
index 014c46b..f8a7f50 100644
--- a/heat/files/logging.conf
+++ b/heat/files/logging.conf
@@ -11,7 +11,7 @@
 keys = {{ log_handlers | join(", ") }}
 
 [formatters]
-keys = context, default, fluentd
+keys = context, default{% if values.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}, fluentd{% endif %}
 
 [logger_root]
 level = WARNING
@@ -65,6 +65,14 @@
 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
 
diff --git a/metadata/service/server/cluster.yml b/metadata/service/server/cluster.yml
index 8c8476f..198b80c 100644
--- a/metadata/service/server/cluster.yml
+++ b/metadata/service/server/cluster.yml
@@ -8,6 +8,7 @@
     heat_client_heat_endpoint_type: publicURL
     openstack_log_appender: false
     openstack_fluentd_handler_enabled: false
+    openstack_ossyslog_handler_enabled: false
   heat:
     server:
       stack_domain_admin:
@@ -59,6 +60,8 @@
             enabled: true
           fluentd:
             enabled: ${_param:openstack_fluentd_handler_enabled}
+          ossyslog:
+            enabled: ${_param:openstack_ossyslog_handler_enabled}
       message_queue:
         engine: rabbitmq
         host: ${_param:cluster_vip_address}
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
index 79be27a..732a975 100644
--- a/metadata/service/server/single.yml
+++ b/metadata/service/server/single.yml
@@ -8,6 +8,7 @@
     heat_client_heat_endpoint_type: publicURL
     openstack_log_appender: false
     openstack_fluentd_handler_enabled: false
+    openstack_ossyslog_handler_enabled: false
   heat:
     server:
       stack_domain_admin:
@@ -59,6 +60,8 @@
             enabled: true
           fluentd:
             enabled: ${_param:openstack_fluentd_handler_enabled}
+          ossyslog:
+            enabled: ${_param:openstack_ossyslog_handler_enabled}
       message_queue:
         engine: rabbitmq
         host: ${_param:single_address}