Add use_journal option for logging configuration

This enables oslo.log to pass logging records to journald.

Change-Id: I37a497fd795eba5b7fb350a044bdb31e46a90ae6
This commit is contained in:
ZhongShengping 2018-01-15 17:40:19 +08:00
parent bdd660ccdb
commit 55d6e99e93
3 changed files with 19 additions and 5 deletions

View File

@ -16,6 +16,10 @@
# (Optional) Use json for logging. # (Optional) Use json for logging.
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*use_journal*]
# (Optional) Use journal for logging.
# Defaults to $::os_service_default.
#
# [*use_stderr*] # [*use_stderr*]
# (optional) Use stderr for logging. # (optional) Use stderr for logging.
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
@ -96,6 +100,7 @@
class zaqar::logging( class zaqar::logging(
$use_syslog = $::os_service_default, $use_syslog = $::os_service_default,
$use_json = $::os_service_default, $use_json = $::os_service_default,
$use_journal = $::os_service_default,
$use_stderr = $::os_service_default, $use_stderr = $::os_service_default,
$log_facility = $::os_service_default, $log_facility = $::os_service_default,
$log_dir = '/var/log/zaqar', $log_dir = '/var/log/zaqar',
@ -129,6 +134,7 @@ class zaqar::logging(
log_date_format => $log_date_format, log_date_format => $log_date_format,
use_syslog => $use_syslog, use_syslog => $use_syslog,
use_json => $use_json, use_json => $use_json,
use_journal => $use_journal,
use_stderr => $use_stderr, use_stderr => $use_stderr,
syslog_log_facility => $log_facility, syslog_log_facility => $log_facility,
log_dir => $log_dir, log_dir => $log_dir,

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds the use_journal option for configuring oslo.log. This will enable
passing the logs to journald.

View File

@ -25,6 +25,7 @@ describe 'zaqar::logging' do
:log_date_format => '%Y-%m-%d %H:%M:%S', :log_date_format => '%Y-%m-%d %H:%M:%S',
:use_syslog => true, :use_syslog => true,
:use_json => true, :use_json => true,
:use_journal => true,
:use_stderr => false, :use_stderr => false,
:log_facility => 'LOG_FOO', :log_facility => 'LOG_FOO',
:log_dir => '/var/log', :log_dir => '/var/log',
@ -50,6 +51,7 @@ describe 'zaqar::logging' do
is_expected.to contain_oslo__log('zaqar_config').with( is_expected.to contain_oslo__log('zaqar_config').with(
:use_syslog => '<SERVICE DEFAULT>', :use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>', :use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>', :use_stderr => '<SERVICE DEFAULT>',
:log_dir => '/var/log/zaqar', :log_dir => '/var/log/zaqar',
:debug => '<SERVICE DEFAULT>', :debug => '<SERVICE DEFAULT>',
@ -62,6 +64,7 @@ describe 'zaqar::logging' do
is_expected.to contain_oslo__log('zaqar_config').with( is_expected.to contain_oslo__log('zaqar_config').with(
:use_syslog => true, :use_syslog => true,
:use_json => true, :use_json => true,
:use_journal => true,
:use_stderr => false, :use_stderr => false,
:syslog_log_facility => 'LOG_FOO', :syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log', :log_dir => '/var/log',