Add use_journal option for logging configuration

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

Change-Id: I0b233c452d16de16378c4ca61ef046419bb3f3dc
This commit is contained in:
ZhongShengping 2018-01-15 16:03:16 +08:00
parent 7a5821568c
commit a6c1b2e04d
3 changed files with 14 additions and 0 deletions

View File

@ -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
@ -105,6 +109,7 @@ class neutron::logging (
$debug = $::os_service_default,
$use_syslog = $::os_service_default,
$use_json = $::os_service_default,
$use_journal = $::os_service_default,
$use_stderr = $::os_service_default,
$log_file = $::os_service_default,
$log_dir = '/var/log/neutron',
@ -141,6 +146,7 @@ class neutron::logging (
use_stderr => $use_stderr_real,
use_syslog => $use_syslog_real,
use_json => $use_json,
use_journal => $use_journal,
syslog_log_facility => $syslog_log_facility,
log_file => $log_file_real,
log_dir => $log_dir_real,

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

@ -26,6 +26,7 @@ describe 'neutron::logging' do
:log_date_format => '%Y-%m-%d %H:%M:%S',
:use_syslog => false,
:use_json => false,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_USER',
:log_dir => '/var/log',
@ -58,6 +59,7 @@ describe 'neutron::logging' do
is_expected.to contain_oslo__log('neutron_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:syslog_log_facility => '<SERVICE DEFAULT>',
:log_dir => '/var/log/neutron',
@ -73,6 +75,7 @@ describe 'neutron::logging' do
is_expected.to contain_oslo__log('neutron_config').with(
:use_syslog => false,
:use_json => false,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_USER',
:log_dir => '/var/log',