Expose use_json logging option
It enables JSON-formatted logging from oslo.log. Change-Id: I2933a99745c7cebe02800ea5af77a6e173e3df46
This commit is contained in:
parent
b1ac198d66
commit
385bd43951
@ -12,6 +12,10 @@
|
|||||||
# (Optional) Use syslog for logging.
|
# (Optional) Use syslog for logging.
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
#
|
#
|
||||||
|
# [*use_json*]
|
||||||
|
# (Optional) Use json 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
|
||||||
@ -95,6 +99,7 @@
|
|||||||
|
|
||||||
class watcher::logging(
|
class watcher::logging(
|
||||||
$use_syslog = $::os_service_default,
|
$use_syslog = $::os_service_default,
|
||||||
|
$use_json = $::os_service_default,
|
||||||
$use_stderr = $::os_service_default,
|
$use_stderr = $::os_service_default,
|
||||||
$syslog_log_facility = $::os_service_default,
|
$syslog_log_facility = $::os_service_default,
|
||||||
$log_dir = '/var/log/watcher',
|
$log_dir = '/var/log/watcher',
|
||||||
@ -118,6 +123,7 @@ class watcher::logging(
|
|||||||
oslo::log { 'watcher_config':
|
oslo::log { 'watcher_config':
|
||||||
use_stderr => $use_stderr,
|
use_stderr => $use_stderr,
|
||||||
use_syslog => $use_syslog,
|
use_syslog => $use_syslog,
|
||||||
|
use_json => $use_json,
|
||||||
log_dir => $log_dir,
|
log_dir => $log_dir,
|
||||||
log_file => $log_file,
|
log_file => $log_file,
|
||||||
debug => $debug,
|
debug => $debug,
|
||||||
|
4
releasenotes/notes/log-json-a87130f234e8771d.yaml
Normal file
4
releasenotes/notes/log-json-a87130f234e8771d.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Expose use_json logging parameter, which enables JSON formatted logging.
|
@ -24,6 +24,7 @@ describe 'watcher::logging' do
|
|||||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
:instance_uuid_format => '[instance: %(uuid)s] ',
|
||||||
: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_stderr => false,
|
:use_stderr => false,
|
||||||
:syslog_log_facility => 'LOG_FOO',
|
:syslog_log_facility => 'LOG_FOO',
|
||||||
:log_dir => '/var/log',
|
:log_dir => '/var/log',
|
||||||
@ -58,6 +59,7 @@ describe 'watcher::logging' do
|
|||||||
it 'configures watcher logging settings with default values' do
|
it 'configures watcher logging settings with default values' do
|
||||||
is_expected.to contain_oslo__log('watcher_config').with(
|
is_expected.to contain_oslo__log('watcher_config').with(
|
||||||
:use_syslog => '<SERVICE DEFAULT>',
|
:use_syslog => '<SERVICE DEFAULT>',
|
||||||
|
:use_json => '<SERVICE DEFAULT>',
|
||||||
:use_stderr => '<SERVICE DEFAULT>',
|
:use_stderr => '<SERVICE DEFAULT>',
|
||||||
:syslog_log_facility => '<SERVICE DEFAULT>',
|
:syslog_log_facility => '<SERVICE DEFAULT>',
|
||||||
:log_dir => '/var/log/watcher',
|
:log_dir => '/var/log/watcher',
|
||||||
@ -71,6 +73,7 @@ describe 'watcher::logging' do
|
|||||||
it 'configures watcher logging settings with non-default values' do
|
it 'configures watcher logging settings with non-default values' do
|
||||||
is_expected.to contain_oslo__log('watcher_config').with(
|
is_expected.to contain_oslo__log('watcher_config').with(
|
||||||
:use_syslog => true,
|
:use_syslog => true,
|
||||||
|
:use_json => 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',
|
||||||
|
Loading…
Reference in New Issue
Block a user