Expose use_json logging option

It enables JSON-formatted logging from oslo.log.

Change-Id: I8a7e1d5324abaeda0d06a885c73b11c01ce718da
This commit is contained in:
Juan Antonio Osorio Robles 2017-11-27 14:52:42 +02:00
parent 2f6c873960
commit aa637da4a6
3 changed files with 13 additions and 0 deletions

View File

@ -12,6 +12,10 @@
# (optional) Use syslog for logging
# Defaults to $::os_service_default
#
# [*use_json*]
# (optional) Use json for logging
# Defaults to $::os_service_default
#
# [*use_stderr*]
# (optional) Use stderr for logging
# Defaults to $::os_service_default
@ -100,6 +104,7 @@
class neutron::logging (
$debug = $::os_service_default,
$use_syslog = $::os_service_default,
$use_json = $::os_service_default,
$use_stderr = $::os_service_default,
$log_file = $::os_service_default,
$log_dir = '/var/log/neutron',
@ -135,6 +140,7 @@ class neutron::logging (
debug => $debug_real,
use_stderr => $use_stderr_real,
use_syslog => $use_syslog_real,
use_json => $use_json,
syslog_log_facility => $syslog_log_facility,
log_file => $log_file_real,
log_dir => $log_dir_real,

View File

@ -0,0 +1,4 @@
---
features:
- |
Expose use_json logging parameter, which enables JSON formatted logging.

View File

@ -25,6 +25,7 @@ describe 'neutron::logging' do
:instance_uuid_format => '[instance: %(uuid)s] ',
:log_date_format => '%Y-%m-%d %H:%M:%S',
:use_syslog => false,
:use_json => false,
:use_stderr => false,
:syslog_log_facility => 'LOG_USER',
:log_dir => '/var/log',
@ -56,6 +57,7 @@ describe 'neutron::logging' do
it 'configures neutron logging settings with default values' do
is_expected.to contain_oslo__log('neutron_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:syslog_log_facility => '<SERVICE DEFAULT>',
:log_dir => '/var/log/neutron',
@ -70,6 +72,7 @@ describe 'neutron::logging' do
it 'configures neutron logging settings with non-default values' do
is_expected.to contain_oslo__log('neutron_config').with(
:use_syslog => false,
:use_json => false,
:use_stderr => false,
:syslog_log_facility => 'LOG_USER',
:log_dir => '/var/log',