Add support of OSSysLogHandler logging handler
Change-Id: If7eb42aa4badf18b3910187bc791109d93834cc8
diff --git a/README.rst b/README.rst
index 215d855..4db341c 100644
--- a/README.rst
+++ b/README.rst
@@ -1095,8 +1095,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:
@@ -1111,6 +1112,8 @@
enabled: true
fluentd:
enabled: true
+ ossyslog:
+ enabled: true
....
compute:
logging:
@@ -1120,6 +1123,8 @@
enabled: true
fluentd:
enabled: true
+ ossyslog:
+ enabled: true
....
gateway:
logging:
@@ -1129,6 +1134,8 @@
enabled: true
fluentd:
enabled: true
+ ossyslog:
+ enabled: true
Documentation and Bugs
======================
diff --git a/metadata/service/compute/ovn/single.yml b/metadata/service/compute/ovn/single.yml
index c62fbc1..4697876 100644
--- a/metadata/service/compute/ovn/single.yml
+++ b/metadata/service/compute/ovn/single.yml
@@ -7,6 +7,7 @@
ovn_external_bridge: br-floating
openstack_log_appender: false
openstack_fluentd_handler_enabled: false
+ openstack_ossyslog_handler_enabled: false
neutron:
compute:
enabled: true
@@ -24,3 +25,5 @@
enabled: true
fluentd:
enabled: ${_param:openstack_fluentd_handler_enabled}
+ ossyslog:
+ enabled: ${_param:openstack_ossyslog_handler_enabled}
diff --git a/metadata/service/compute/single.yml b/metadata/service/compute/single.yml
index 1884bbd..2c6f177 100644
--- a/metadata/service/compute/single.yml
+++ b/metadata/service/compute/single.yml
@@ -6,6 +6,7 @@
_param:
openstack_log_appender: false
openstack_fluentd_handler_enabled: false
+ openstack_ossyslog_handler_enabled: false
neutron:
compute:
enabled: true
@@ -39,3 +40,5 @@
enabled: true
fluentd:
enabled: ${_param:openstack_fluentd_handler_enabled}
+ ossyslog:
+ enabled: ${_param:openstack_ossyslog_handler_enabled}
diff --git a/metadata/service/control/cluster.yml b/metadata/service/control/cluster.yml
index 844d590..7f024c1 100644
--- a/metadata/service/control/cluster.yml
+++ b/metadata/service/control/cluster.yml
@@ -7,6 +7,7 @@
keystone_neutron_endpoint_type: internal
openstack_log_appender: false
openstack_fluentd_handler_enabled: false
+ openstack_ossyslog_handler_enabled: false
neutron:
server:
enabled: true
@@ -40,6 +41,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/control/single.yml b/metadata/service/control/single.yml
index 91fd911..d0ee1c5 100644
--- a/metadata/service/control/single.yml
+++ b/metadata/service/control/single.yml
@@ -7,6 +7,7 @@
keystone_neutron_endpoint_type: internal
openstack_log_appender: false
openstack_fluentd_handler_enabled: false
+ openstack_ossyslog_handler_enabled: false
neutron:
server:
enabled: true
@@ -44,6 +45,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}
diff --git a/metadata/service/gateway/single.yml b/metadata/service/gateway/single.yml
index 860e18a..2649449 100644
--- a/metadata/service/gateway/single.yml
+++ b/metadata/service/gateway/single.yml
@@ -6,6 +6,7 @@
_param:
openstack_log_appender: false
openstack_fluentd_handler_enabled: false
+ openstack_ossyslog_handler_enabled: false
neutron:
gateway:
enabled: true
@@ -39,3 +40,5 @@
enabled: true
fluentd:
enabled: ${_param:openstack_fluentd_handler_enabled}
+ ossyslog:
+ enabled: ${_param:openstack_ossyslog_handler_enabled}
diff --git a/neutron/files/logging.conf b/neutron/files/logging.conf
index 717f218..155a440 100644
--- a/neutron/files/logging.conf
+++ b/neutron/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
@@ -61,6 +61,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/neutron/files/ocata/neutron-server b/neutron/files/ocata/neutron-server
index 5061cca..07fba29 100644
--- a/neutron/files/ocata/neutron-server
+++ b/neutron/files/ocata/neutron-server
@@ -15,6 +15,6 @@
NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/opencontrail/ContrailPlugin.ini"
{%- endif %}
-{%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
+{%- if server.logging.log_appender %}
DAEMON_ARGS="--log-config-append=/etc/neutron/logging/logging-neutron-server.conf"
{%- endif %}
diff --git a/neutron/files/pike/neutron-server b/neutron/files/pike/neutron-server
index 04830ca..07fba29 100644
--- a/neutron/files/pike/neutron-server
+++ b/neutron/files/pike/neutron-server
@@ -13,4 +13,8 @@
{%- if server.backend.engine == "contrail" %}
NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/opencontrail/ContrailPlugin.ini"
-{%- endif %}
\ No newline at end of file
+{%- endif %}
+
+{%- if server.logging.log_appender %}
+DAEMON_ARGS="--log-config-append=/etc/neutron/logging/logging-neutron-server.conf"
+{%- endif %}