Add watch_log_file option

Add support for Using logging handler designed to watch file system.

Change-Id: I0097c68ea253b1cee58132e677adc39dd7c3b20a
Closes-Bug: #1943212
This commit is contained in:
ZhongShengping 2021-09-14 16:02:08 +08:00
parent fb66d022e1
commit 3af5e3dbc2
3 changed files with 21 additions and 8 deletions

View File

@ -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,
}

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``gnocchi::logging::watch_log_file`` parameter has been added.

View File

@ -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 => '<SERVICE DEFAULT>',
:log_dir => '/var/log/gnocchi',
:log_file => '<SERVICE DEFAULT>',
:watch_log_file => '<SERVICE DEFAULT>',
:debug => '<SERVICE DEFAULT>',
)
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