From 78b9e1d743d6b62369c3277d6770319b65095888 Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Mon, 27 Nov 2017 14:57:17 +0200 Subject: [PATCH] Expose use_json logging option It enables JSON-formatted logging from oslo.log. Change-Id: Ifc742e16748195c3cb699ac1e1dc6a36b3861d02 --- manifests/logging.pp | 6 ++++++ releasenotes/notes/log-json-19a16ad82e22fd82.yaml | 4 ++++ spec/classes/ceilometer_logging_spec.rb | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/log-json-19a16ad82e22fd82.yaml diff --git a/manifests/logging.pp b/manifests/logging.pp index 748b91c7..a77f4b82 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -12,6 +12,10 @@ # (Optional) Use syslog for logging. # Defaults to $::os_service_default. # +# [*use_json*] +# (Optional) Use json for logging. +# Defaults to $::os_service_default. +# # [*use_stderr*] # (Optional) Use stderr for logging # Defaults to $::os_service_default. @@ -87,6 +91,7 @@ # class ceilometer::logging( $use_syslog = $::os_service_default, + $use_json = $::os_service_default, $use_stderr = $::os_service_default, $log_facility = $::os_service_default, $log_dir = '/var/log/ceilometer', @@ -122,6 +127,7 @@ class ceilometer::logging( debug => $debug_real, use_stderr => $use_stderr_real, use_syslog => $use_syslog_real, + use_json => $use_json, log_dir => $log_dir_real, syslog_log_facility => $log_facility_real, logging_context_format_string => $logging_context_format_string, diff --git a/releasenotes/notes/log-json-19a16ad82e22fd82.yaml b/releasenotes/notes/log-json-19a16ad82e22fd82.yaml new file mode 100644 index 00000000..41c04132 --- /dev/null +++ b/releasenotes/notes/log-json-19a16ad82e22fd82.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Expose use_json logging parameter, which enables JSON formatted logging. diff --git a/spec/classes/ceilometer_logging_spec.rb b/spec/classes/ceilometer_logging_spec.rb index 8e7c7229..fdcbb010 100644 --- a/spec/classes/ceilometer_logging_spec.rb +++ b/spec/classes/ceilometer_logging_spec.rb @@ -24,6 +24,7 @@ describe 'ceilometer::logging' do :instance_uuid_format => '[instance: %(uuid)s] ', :log_date_format => '%Y-%m-%d %H:%M:%S', :use_syslog => true, + :use_json => true, :use_stderr => false, :log_facility => 'LOG_FOO', :log_dir => '/var/log', @@ -57,6 +58,7 @@ describe 'ceilometer::logging' do it 'configures ceilometer logging settings with default values' do is_expected.to contain_oslo__log('ceilometer_config').with( :use_syslog => '', + :use_json => '', :use_stderr => '', :syslog_log_facility => '', :log_dir => '/var/log/ceilometer', @@ -69,6 +71,7 @@ describe 'ceilometer::logging' do it 'configures ceilometer logging settings with non-default values' do is_expected.to contain_oslo__log('ceilometer_config').with( :use_syslog => true, + :use_json => true, :use_stderr => false, :syslog_log_facility => 'LOG_FOO', :log_dir => '/var/log',