From befa77c07955b3e5633470bc1b6f3fcebcc4aa6a Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Mon, 15 Jan 2018 15:50:08 +0800 Subject: [PATCH] Add use_journal option for logging configuration This enables oslo.log to pass logging records to journald. Change-Id: Iff58d247fe90fa8d81769599d7ce994077c032d9 --- manifests/logging.pp | 6 ++++++ ...journal-option-for-logging-b152b982a916e35e.yaml | 5 +++++ spec/classes/heat_logging_spec.rb | 13 ++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/add-use_journal-option-for-logging-b152b982a916e35e.yaml diff --git a/manifests/logging.pp b/manifests/logging.pp index cb7de0c0..1b5b3fcb 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -16,6 +16,10 @@ # (Optional) Use json for logging. # Defaults to $::os_service_default. # +# [*use_journal*] +# (Optional) Use journal for logging. +# Defaults to $::os_service_default. +# # [*use_stderr*] # (optional) Use stderr for logging. # Defaults to $::os_service_default. @@ -92,6 +96,7 @@ class heat::logging( $use_syslog = $::os_service_default, $use_json = $::os_service_default, + $use_journal = $::os_service_default, $use_stderr = $::os_service_default, $log_facility = $::os_service_default, $log_dir = '/var/log/heat', @@ -130,6 +135,7 @@ class heat::logging( log_dir => $log_dir_real, use_syslog => $use_syslog_real, use_json => $use_json, + use_journal => $use_journal, syslog_log_facility => $log_facility_real, use_stderr => $use_stderr_real, logging_context_format_string => $logging_context_format_string, diff --git a/releasenotes/notes/add-use_journal-option-for-logging-b152b982a916e35e.yaml b/releasenotes/notes/add-use_journal-option-for-logging-b152b982a916e35e.yaml new file mode 100644 index 00000000..12b190e7 --- /dev/null +++ b/releasenotes/notes/add-use_journal-option-for-logging-b152b982a916e35e.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds the use_journal option for configuring oslo.log. This will enable + passing the logs to journald. diff --git a/spec/classes/heat_logging_spec.rb b/spec/classes/heat_logging_spec.rb index 59e1df28..5b16e8ca 100644 --- a/spec/classes/heat_logging_spec.rb +++ b/spec/classes/heat_logging_spec.rb @@ -25,6 +25,7 @@ describe 'heat::logging' do :log_date_format => '%Y-%m-%d %H:%M:%S', :use_syslog => true, :use_json => true, + :use_journal => true, :use_stderr => false, :log_facility => 'LOG_FOO', :log_dir => '/var/log', @@ -57,11 +58,12 @@ describe 'heat::logging' do shared_examples 'basic default logging settings' do it 'configures heat logging settings with default values' do is_expected.to contain_oslo__log('heat_config').with( - :use_syslog => '', - :use_json => '', - :use_stderr => '', - :log_dir => '/var/log/heat', - :debug => '', + :use_syslog => '', + :use_json => '', + :use_journal => '', + :use_stderr => '', + :log_dir => '/var/log/heat', + :debug => '', ) end end @@ -71,6 +73,7 @@ describe 'heat::logging' do is_expected.to contain_oslo__log('heat_config').with( :use_syslog => true, :use_json => true, + :use_journal => true, :use_stderr => false, :syslog_log_facility => 'LOG_FOO', :log_dir => '/var/log',