Add support of OSSysLogHandler logging handler

Change-Id: Ic65dcc2b82a3b26d8fedf9543da3e350d2260c7d
diff --git a/README.rst b/README.rst
index f165775..2b6483c 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,6 +236,8 @@
             enabled: true
           fluentd:
             enabled: true
+          ossyslog:
+            enabled: true
 
     agent:
       logging:
@@ -244,6 +247,8 @@
             enabled: true
           fluentd:
             enabled: true
+          ossyslog:
+            enabled: true
 
 
 More Information
diff --git a/ceilometer/files/logging.conf b/ceilometer/files/logging.conf
index dfd181c..fedad29 100644
--- a/ceilometer/files/logging.conf
+++ b/ceilometer/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
@@ -37,6 +37,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/agent/cluster.yml b/metadata/service/agent/cluster.yml
index 91cf7d9..c2ec588 100644
--- a/metadata/service/agent/cluster.yml
+++ b/metadata/service/agent/cluster.yml
@@ -7,6 +7,7 @@
     keystone_ceilometer_endpoint_type: internalURL
     openstack_log_appender: false
     openstack_fluentd_handler_enabled: false
+    openstack_ossyslog_handler_enabled: false
   ceilometer:
     agent:
       enabled: true
@@ -29,6 +30,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/agent/single.yml b/metadata/service/agent/single.yml
index 23ee9ee..63d0312 100644
--- a/metadata/service/agent/single.yml
+++ b/metadata/service/agent/single.yml
@@ -7,6 +7,7 @@
     keystone_ceilometer_endpoint_type: internalURL
     openstack_log_appender: false
     openstack_fluentd_handler_enabled: false
+    openstack_ossyslog_handler_enabled: false
   ceilometer:
     agent:
       enabled: true
@@ -29,6 +30,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/cluster.yml b/metadata/service/server/cluster.yml
index 5b190a8..44d1655 100644
--- a/metadata/service/server/cluster.yml
+++ b/metadata/service/server/cluster.yml
@@ -7,6 +7,7 @@
     keystone_ceilometer_endpoint_type: internalURL
     openstack_log_appender: false
     openstack_fluentd_handler_enabled: false
+    openstack_ossyslog_handler_enabled: false
   ceilometer:
     server:
       enabled: true
@@ -34,6 +35,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 d246599..05d617b 100644
--- a/metadata/service/server/single.yml
+++ b/metadata/service/server/single.yml
@@ -7,6 +7,7 @@
     keystone_ceilometer_endpoint_type: internalURL
     openstack_log_appender: false
     openstack_fluentd_handler_enabled: false
+    openstack_ossyslog_handler_enabled: false
   ceilometer:
     server:
       enabled: true
@@ -33,6 +34,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}