Add use_journal option for logging configuration

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

Change-Id: I1ebe450c74d13a26a44f1e06b9f2e92bd40f4ce6
This commit is contained in:
ZhongShengping
2018-01-15 15:48:37 +08:00
parent 4708032651
commit f63a707d51
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
@@ -95,6 +99,7 @@
class gnocchi::logging(
$use_syslog = $::os_service_default,
$use_json = $::os_service_default,
$use_journal = $::os_service_default,
$use_stderr = $::os_service_default,
$log_facility = $::os_service_default,
$log_dir = '/var/log/gnocchi',
@@ -175,6 +180,7 @@ class gnocchi::logging(
debug => $debug_real,
use_syslog => $use_syslog_real,
use_json => $use_json,
use_journal => $use_journal,
use_stderr => $use_stderr_real,
log_dir => $log_dir_real,
syslog_log_facility => $log_facility_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

@@ -11,6 +11,7 @@ describe 'gnocchi::logging' do
{
:use_syslog => true,
:use_json => true,
:use_journal => true,
:use_stderr => false,
:log_facility => 'LOG_FOO',
:log_dir => '/var/log',
@@ -36,6 +37,7 @@ describe 'gnocchi::logging' do
is_expected.to contain_oslo__log('gnocchi_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/gnocchi',
@@ -49,6 +51,7 @@ describe 'gnocchi::logging' do
is_expected.to contain_oslo__log('gnocchi_config').with(
:use_syslog => true,
:use_json => true,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',