Allow (more) customization of amphora log offloading

This change extends coverage of [amphora_agent] options so that users
can customize these parameters.

Especially the log_protocol parameter is required to use TCP protocol
instead of UDP protocol for log transferring, for more robust logging.

Change-Id: I697fdbef762c69bb1494eae1cfa8252a2bd2c9b3
This commit is contained in:
Takashi Kajinami 2022-07-11 16:10:08 +09:00
parent 7685156256
commit 02965a6077
3 changed files with 57 additions and 0 deletions

View File

@ -179,6 +179,27 @@
# (optional) The tenant traffic flow log format string. # (optional) The tenant traffic flow log format string.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*log_protocol*]
# (optional) The log forwarding transport protoocl. One of UDP or TCP.
# Defaults to $::os_service_default
#
# [*log_retry_count*]
# (optional) The maximum attempts to retry connecting to the logging host.
# Defaults to $::os_service_default
#
# [*log_retry_interval*]
# (optional) The time, in seconds, to wait between retries connecting to
# the logging host.
# Defaults to $::os_service_default
#
# [*log_queue_size*]
# (optional) The queue size (messages) to buffer log messages.
# Defaults to $::os_service_default
#
# [*logging_template_override*]
# (optional) Custom logging configuration template.
# Defaults to $::os_service_default
#
# [*disable_local_log_storage*] # [*disable_local_log_storage*]
# (optional) When true, logs will not be stored on the amphora filesystem. # (optional) When true, logs will not be stored on the amphora filesystem.
# This includes all kernel, system, and security logs. # This includes all kernel, system, and security logs.
@ -268,6 +289,11 @@ class octavia::controller (
$tenant_log_targets = $::os_service_default, $tenant_log_targets = $::os_service_default,
$user_log_facility = $::os_service_default, $user_log_facility = $::os_service_default,
$user_log_format = $::os_service_default, $user_log_format = $::os_service_default,
$log_protocol = $::os_service_default,
$log_retry_count = $::os_service_default,
$log_retry_interval = $::os_service_default,
$log_queue_size = $::os_service_default,
$logging_template_override = $::os_service_default,
$disable_local_log_storage = $::os_service_default, $disable_local_log_storage = $::os_service_default,
$vrrp_advert_int = $::os_service_default, $vrrp_advert_int = $::os_service_default,
$vrrp_check_interval = $::os_service_default, $vrrp_check_interval = $::os_service_default,
@ -343,6 +369,11 @@ Use the octavia::networking class instead')
'amphora_agent/tenant_log_targets' : value => join(any2array($tenant_log_targets), ','); 'amphora_agent/tenant_log_targets' : value => join(any2array($tenant_log_targets), ',');
'amphora_agent/user_log_facility' : value => $user_log_facility; 'amphora_agent/user_log_facility' : value => $user_log_facility;
'haproxy_amphora/user_log_format' : value => $user_log_format; 'haproxy_amphora/user_log_format' : value => $user_log_format;
'amphora_agent/log_protocol' : value => $log_protocol;
'amphora_agent/log_retry_count' : value => $log_retry_count;
'amphora_agent/log_retry_interval' : value => $log_retry_interval;
'amphora_agent/log_queue_size' : value => $log_queue_size;
'amphora_agent/logging_template_override' : value => $logging_template_override;
'amphora_agent/disable_local_log_storage' : value => $disable_local_log_storage; 'amphora_agent/disable_local_log_storage' : value => $disable_local_log_storage;
'keepalived_vrrp/vrrp_advert_int' : value => $vrrp_advert_int; 'keepalived_vrrp/vrrp_advert_int' : value => $vrrp_advert_int;
'keepalived_vrrp/vrrp_check_interval' : value => $vrrp_check_interval; 'keepalived_vrrp/vrrp_check_interval' : value => $vrrp_check_interval;

View File

@ -0,0 +1,11 @@
---
features:
- |
The ``octavia::controller`` class now supports the following parameters,
to customize behavior of the log offloading feature.
- ``log_protocol``
- ``log_retry_count``
- ``log_retry_interval``
- ``log_queue_size``
- ``logging_template_override``

View File

@ -51,6 +51,11 @@ describe 'octavia::controller' do
:tenant_log_targets => ['192.0.2.1:10514', '2001:db8:1::10:10514'], :tenant_log_targets => ['192.0.2.1:10514', '2001:db8:1::10:10514'],
:user_log_facility => 3, :user_log_facility => 3,
:user_log_format => '{{ project_id }} {{ lb_id }}', :user_log_format => '{{ project_id }} {{ lb_id }}',
:log_protocol => 'TCP',
:log_retry_count => 5,
:log_retry_interval => 2,
:log_queue_size => 10000,
:logging_template_override => 'mycustomtemplate',
:disable_local_log_storage => true, :disable_local_log_storage => true,
:vrrp_advert_int => 1, :vrrp_advert_int => 1,
:vrrp_check_interval => 5, :vrrp_check_interval => 5,
@ -103,6 +108,11 @@ describe 'octavia::controller' do
is_expected.to contain_octavia_config('amphora_agent/tenant_log_targets').with_value('192.0.2.1:10514,2001:db8:1::10:10514') is_expected.to contain_octavia_config('amphora_agent/tenant_log_targets').with_value('192.0.2.1:10514,2001:db8:1::10:10514')
is_expected.to contain_octavia_config('amphora_agent/user_log_facility').with_value(3) is_expected.to contain_octavia_config('amphora_agent/user_log_facility').with_value(3)
is_expected.to contain_octavia_config('haproxy_amphora/user_log_format').with_value('{{ project_id }} {{ lb_id }}') is_expected.to contain_octavia_config('haproxy_amphora/user_log_format').with_value('{{ project_id }} {{ lb_id }}')
is_expected.to contain_octavia_config('amphora_agent/log_protocol').with_value('TCP')
is_expected.to contain_octavia_config('amphora_agent/log_retry_count').with_value(5)
is_expected.to contain_octavia_config('amphora_agent/log_retry_interval').with_value(2)
is_expected.to contain_octavia_config('amphora_agent/log_queue_size').with_value(10000)
is_expected.to contain_octavia_config('amphora_agent/logging_template_override').with_value('mycustomtemplate')
is_expected.to contain_octavia_config('amphora_agent/disable_local_log_storage').with_value(true) is_expected.to contain_octavia_config('amphora_agent/disable_local_log_storage').with_value(true)
is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_advert_int').with_value(1) is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_advert_int').with_value(1)
is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_check_interval').with_value(5) is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_check_interval').with_value(5)
@ -156,6 +166,11 @@ describe 'octavia::controller' do
is_expected.to contain_octavia_config('amphora_agent/tenant_log_targets').with_value('<SERVICE DEFAULT>') is_expected.to contain_octavia_config('amphora_agent/tenant_log_targets').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/user_log_facility').with_value('<SERVICE DEFAULT>') is_expected.to contain_octavia_config('amphora_agent/user_log_facility').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('haproxy_amphora/user_log_format').with_value('<SERVICE DEFAULT>') is_expected.to contain_octavia_config('haproxy_amphora/user_log_format').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/log_protocol').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/log_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/log_retry_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/log_queue_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/logging_template_override').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('amphora_agent/disable_local_log_storage').with_value('<SERVICE DEFAULT>') is_expected.to contain_octavia_config('amphora_agent/disable_local_log_storage').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_advert_int').with_value('<SERVICE DEFAULT>') is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_advert_int').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_check_interval').with_value('<SERVICE DEFAULT>') is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_check_interval').with_value('<SERVICE DEFAULT>')