Support customizing log_max_line_length

Change-Id: Id7d89b82703469838bcdd71ab0b2a0e82480f971
This commit is contained in:
Takashi Kajinami 2024-10-26 18:14:31 +09:00
parent e4941136f1
commit 8afd4fa6d3
10 changed files with 57 additions and 15 deletions

View File

@ -103,6 +103,10 @@
# (optional) Location where syslog sends the logs to.
# Defaults to '/dev/log'.
#
# [*log_max_line_length*]
# (optional) Caps the length of log lines to the value given.
# Defaults to $facts['os_service_default'].
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the proxy config.
@ -129,6 +133,7 @@ class swift::containerreconciler(
$log_level = 'INFO',
$log_facility = 'LOG_LOCAL2',
$log_address = '/dev/log',
$log_max_line_length = $facts['os_service_default'],
Boolean $purge_config = false,
) inherits swift::params {
@ -197,6 +202,7 @@ class swift::containerreconciler(
'container-reconciler/log_facility': value => $log_facility;
'container-reconciler/log_level': value => $log_level;
'container-reconciler/log_address': value => $log_address;
'container-reconciler/log_max_line_length': value => $log_max_line_length;
}
if $manage_service {

View File

@ -109,6 +109,10 @@
# (optional) Location where syslog sends the logs to.
# Defaults to '/dev/log'.
#
# [*log_max_line_length*]
# (optional) Caps the length of log lines to the value given.
# Defaults to $facts['os_service_default'].
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the object expirer config.
@ -137,6 +141,7 @@ class swift::objectexpirer(
$log_level = 'INFO',
$log_facility = 'LOG_LOCAL2',
$log_address = '/dev/log',
$log_max_line_length = $facts['os_service_default'],
Boolean $purge_config = false,
) inherits swift::params {
@ -217,6 +222,7 @@ class swift::objectexpirer(
'object-expirer/log_facility': value => $log_facility;
'object-expirer/log_level': value => $log_level;
'object-expirer/log_address': value => $log_address;
'object-expirer/log_max_line_length': value => $log_max_line_length;
}
if $manage_service {

View File

@ -67,6 +67,10 @@
# (optional) Configures log_name for swift proxy-server.
# Defaults to proxy-server
#
# [*log_max_line_length*]
# (optional) Caps the length of log lines to the value given.
# Defaults to $facts['os_service_default'].
#
# [*object_chunk_size*]
# (optional) Chunk size to read from object servers.
# Defaults to $facts['os_service_default'].
@ -202,6 +206,7 @@ class swift::proxy(
$log_facility = 'LOG_LOCAL2',
$log_handoffs = $facts['os_service_default'],
$log_name = 'proxy-server',
$log_max_line_length = $facts['os_service_default'],
$cors_allow_origin = $facts['os_service_default'],
$strict_cors_mode = $facts['os_service_default'],
$cors_expose_headers = $facts['os_service_default'],
@ -280,6 +285,7 @@ class swift::proxy(
'DEFAULT/log_address': value => $log_address;
'DEFAULT/log_udp_host': value => $log_udp_host;
'DEFAULT/log_udp_port': value => $log_udp_port;
'DEFAULT/log_max_line_length': value => $log_max_line_length;
'DEFAULT/client_timeout': value => $client_timeout;
'DEFAULT/keepalive_timeout': value => $keepalive_timeout;
'pipeline:main/pipeline': value => join($pipeline, ' ');

View File

@ -53,6 +53,10 @@
# (Optional) Port value for UDP receiver, if enabled.
# Defaults to undef.
#
# [*log_max_line_length*]
# (Optional) Caps the length of log lines to the value given.
# Defaults to $facts['os_service_default'].
#
# [*device_dir*]
# (Optional) Directory devices are mounted under
# Defaults to $facts['os_service_default'].
@ -112,6 +116,7 @@ class swift::storage::drive_audit(
$log_name = 'drive-audit',
$log_udp_host = undef,
$log_udp_port = undef,
$log_max_line_length = $facts['os_service_default'],
$device_dir = '/srv/node',
$minutes = $facts['os_service_default'],
$error_limit = $facts['os_service_default'],
@ -146,6 +151,7 @@ class swift::storage::drive_audit(
'drive-audit/log_facility' : value => $log_facility;
'drive-audit/log_level' : value => $log_level;
'drive-audit/log_address' : value => $log_address;
'drive-audit/log_max_line_length' : value => $log_max_line_length;
}
if $log_udp_host {

View File

@ -190,6 +190,10 @@
# (optional) Port value for UDP receiver, if enabled.
# Defaults to undef.
#
# [*log_max_line_length*]
# (optional) Caps the length of log lines to the value given.
# Defaults to $facts['os_service_default'].
#
# [*log_requests*]
# (optional) Whether or not log every request. reduces logging output if false,
# good for seeing errors if true
@ -327,6 +331,7 @@ define swift::storage::server(
$log_udp_host = $facts['os_service_default'],
$log_udp_port = $facts['os_service_default'],
$log_requests = true,
$log_max_line_length = $facts['os_service_default'],
# this parameters needs to be specified after type and name
Boolean $statsd_enabled = false,
$log_statsd_host = 'localhost',
@ -443,6 +448,7 @@ define swift::storage::server(
'DEFAULT/log_address' => {'value' => $log_address},
'DEFAULT/log_udp_host' => {'value' => $log_udp_host},
'DEFAULT/log_udp_port' => {'value' => $log_udp_port},
'DEFAULT/log_max_line_length' => {'value' => $log_max_line_length},
# pipeline
'pipeline:main/pipeline' => {'value' => join($pipeline, ' ')},
# server

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``log_max_line_length`` parameter has been added.

View File

@ -42,6 +42,8 @@ describe 'swift::containerreconciler' do
'container-reconciler/log_facility').with_value('LOG_LOCAL2')
is_expected.to contain_swift_container_reconciler_config(
'container-reconciler/log_address').with_value('/dev/log')
is_expected.to contain_swift_container_reconciler_config(
'container-reconciler/log_max_line_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_reconciler_config(
'filter:cache/memcache_servers').with_value('127.0.0.1:11211')
is_expected.to contain_swift_container_reconciler_config(

View File

@ -46,6 +46,8 @@ describe 'swift::objectexpirer' do
'object-expirer/log_facility').with_value('LOG_LOCAL2')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/log_address').with_value('/dev/log')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/log_max_line_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'filter:cache/memcache_servers').with_value('127.0.0.1:11211')
is_expected.to contain_swift_object_expirer_config(

View File

@ -16,6 +16,7 @@ describe 'swift::storage::drive_audit' do
should contain_swift_drive_audit_config('drive-audit/log_facility').with_value('LOG_LOCAL2')
should contain_swift_drive_audit_config('drive-audit/log_level').with_value('INFO')
should contain_swift_drive_audit_config('drive-audit/log_address').with_value('/dev/log')
should contain_swift_drive_audit_config('drive-audit/log_max_line_length').with_value('<SERVICE DEFAULT>')
should contain_swift_drive_audit_config('drive-audit/log_udp_host').with_value('<SERVICE DEFAULT>')
should contain_swift_drive_audit_config('drive-audit/log_udp_port').with_value('<SERVICE DEFAULT>')

View File

@ -83,6 +83,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_account_config('DEFAULT/log_address').with_value('/dev/log')
is_expected.to contain_swift_account_config('DEFAULT/log_udp_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_udp_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_max_line_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('pipeline:main/pipeline').with_value('account-server')
is_expected.to contain_swift_account_config('app:account-server/use').with_value('egg:swift#account')
is_expected.to contain_swift_account_config('app:account-server/set log_name').with_value('account-server')
@ -273,6 +274,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_container_config('DEFAULT/log_address').with_value('/dev/log')
is_expected.to contain_swift_container_config('DEFAULT/log_udp_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_udp_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_max_line_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('pipeline:main/pipeline').with_value('container-server')
is_expected.to contain_swift_container_config('app:container-server/use').with_value('egg:swift#container')
is_expected.to contain_swift_container_config('app:container-server/set log_name').with_value('container-server')
@ -468,6 +470,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_object_config('DEFAULT/log_address').with_value('/dev/log')
is_expected.to contain_swift_object_config('DEFAULT/log_udp_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/log_udp_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/log_max_line_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('pipeline:main/pipeline').with_value('object-server')
is_expected.to contain_swift_object_config('app:object-server/use').with_value('egg:swift#object')
is_expected.to contain_swift_object_config('app:object-server/set log_name').with_value('object-server')