From 7becf0017cdadde0cb999b9eb2e478e4411a2997 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 22 Sep 2024 02:15:26 +0900 Subject: [PATCH] Drop hard-coded log_file Because the service config file is shared among multiple services, we should not set the option without any specific reason. In case the option is not set (and no --log-file argument is passed) then log file name is determined according to the process name, and each service creates its own file. Change-Id: I65b1abc96be4503d51d8b1af2c4ece7aa52be563 --- manifests/logging.pp | 4 ++-- .../notes/drop-hardcoded-log_file-3f656a530073379f.yaml | 6 ++++++ spec/classes/watcher_logging_spec.rb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/drop-hardcoded-log_file-3f656a530073379f.yaml diff --git a/manifests/logging.pp b/manifests/logging.pp index c3002a5..9fd040f 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -35,7 +35,7 @@ # # [*log_file*] # (Optional) File where logs should be stored. -# Defaults to '/var/log/watcher/watcher.log' +# Defaults to $facts['os_service_default'] # # [*logging_context_format_string*] # (Optional) Format string to use for log messages with context. @@ -114,7 +114,7 @@ class watcher::logging( $use_stderr = $facts['os_service_default'], $syslog_log_facility = $facts['os_service_default'], $log_dir = '/var/log/watcher', - $log_file = '/var/log/watcher/watcher.log', + $log_file = $facts['os_service_default'], $debug = $facts['os_service_default'], $logging_context_format_string = $facts['os_service_default'], $logging_default_format_string = $facts['os_service_default'], diff --git a/releasenotes/notes/drop-hardcoded-log_file-3f656a530073379f.yaml b/releasenotes/notes/drop-hardcoded-log_file-3f656a530073379f.yaml new file mode 100644 index 0000000..ca1fde5 --- /dev/null +++ b/releasenotes/notes/drop-hardcoded-log_file-3f656a530073379f.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The ``watcher::logging::log_file`` now defaults to the os_service_default + fact so that log file name is determined automatically accoridng to + the process names. diff --git a/spec/classes/watcher_logging_spec.rb b/spec/classes/watcher_logging_spec.rb index 08c548d..629e0ec 100644 --- a/spec/classes/watcher_logging_spec.rb +++ b/spec/classes/watcher_logging_spec.rb @@ -66,7 +66,7 @@ describe 'watcher::logging' do :use_stderr => '', :syslog_log_facility => '', :log_dir => '/var/log/watcher', - :log_file => '/var/log/watcher/watcher.log', + :log_file => '', :debug => '', ) end