From 3af5e3dbc273f70b2ad48fd52a74150efb760219 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Tue, 14 Sep 2021 16:02:08 +0800 Subject: [PATCH] Add watch_log_file option Add support for Using logging handler designed to watch file system. Change-Id: I0097c68ea253b1cee58132e677adc39dd7c3b20a Closes-Bug: #1943212 --- manifests/logging.pp | 6 ++++++ ...atch_log_file-option-89d790e542d4d081.yaml | 4 ++++ spec/classes/gnocchi_logging_spec.rb | 19 +++++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/add_watch_log_file-option-89d790e542d4d081.yaml diff --git a/manifests/logging.pp b/manifests/logging.pp index 180b71ec..9eba5ab8 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -38,6 +38,10 @@ # (Optional) File where logs should be stored. # Defaults to $::os_service_default # +# [*watch_log_file*] +# (Optional) Uses logging handler designed to watch file system (boolean value). +# Defaults to $::os_service_default +# class gnocchi::logging( $use_syslog = $::os_service_default, $use_json = $::os_service_default, @@ -46,6 +50,7 @@ class gnocchi::logging( $log_facility = $::os_service_default, $log_dir = '/var/log/gnocchi', $log_file = $::os_service_default, + $watch_log_file = $::os_service_default, $debug = $::os_service_default, ) { @@ -59,6 +64,7 @@ class gnocchi::logging( use_stderr => $use_stderr, log_dir => $log_dir, log_file => $log_file, + watch_log_file => $watch_log_file, syslog_log_facility => $log_facility, } diff --git a/releasenotes/notes/add_watch_log_file-option-89d790e542d4d081.yaml b/releasenotes/notes/add_watch_log_file-option-89d790e542d4d081.yaml new file mode 100644 index 00000000..0fdb8c86 --- /dev/null +++ b/releasenotes/notes/add_watch_log_file-option-89d790e542d4d081.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``gnocchi::logging::watch_log_file`` parameter has been added. diff --git a/spec/classes/gnocchi_logging_spec.rb b/spec/classes/gnocchi_logging_spec.rb index 024deb6c..60b0f7bf 100644 --- a/spec/classes/gnocchi_logging_spec.rb +++ b/spec/classes/gnocchi_logging_spec.rb @@ -9,14 +9,15 @@ describe 'gnocchi::logging' do let :log_params do { - :use_syslog => true, - :use_json => true, - :use_journal => true, - :use_stderr => false, - :log_facility => 'LOG_FOO', - :log_dir => '/var/log', - :log_file => '/var/log/gnocchi/gnocchi.log', - :debug => true, + :use_syslog => true, + :use_json => true, + :use_journal => true, + :use_stderr => false, + :log_facility => 'LOG_FOO', + :log_dir => '/var/log', + :log_file => '/var/log/gnocchi/gnocchi.log', + :watch_log_file => true, + :debug => true, } end @@ -43,6 +44,7 @@ describe 'gnocchi::logging' do :syslog_log_facility => '', :log_dir => '/var/log/gnocchi', :log_file => '', + :watch_log_file => '', :debug => '', ) end @@ -58,6 +60,7 @@ describe 'gnocchi::logging' do :syslog_log_facility => 'LOG_FOO', :log_dir => '/var/log', :log_file => '/var/log/gnocchi/gnocchi.log', + :watch_log_file => true, :debug => true, ) end