Fix rsyslog configuration when disabling logs
Fix an invalid rsyslog configuration when disabling both log offloading and local log storage. Story 2008782 Task 42173 Change-Id: I3125cfc7b3bd12eed139b058fc2bb7f23f12abc7 (cherry picked from commite26664de59
) (cherry picked from commit2195a45a1b
)
This commit is contained in:
parent
8829f0fbbe
commit
bae6808f1c
@ -14,14 +14,19 @@
|
||||
# under the License.
|
||||
#}
|
||||
{#- Tenant traffic logs -#}
|
||||
{%- if tenant_log_hosts -%}
|
||||
local{{ user_log_facility }}.=info {% for host in tenant_log_hosts %}{% if not loop.first %}&{% endif %}action(type="omfwd" target="{{ host['host'] }}" port="{{ host['port'] }}" protocol="{{ protocol }}" action.resumeRetryCount="{{ retry_count }}" action.resumeInterval="{{ retry_interval }}" queue.type="linkedList" queue.size="{{ queue_size }}" {% if not loop.first %}action.execOnlyWhenPreviousIsSuspended="on"{% endif %}){% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
{#- Administrative logs -#}
|
||||
{%- if admin_log_hosts -%}
|
||||
{%- if forward_all_logs %}
|
||||
*.*;local{{ user_log_facility }}.none {% for host in admin_log_hosts %}{% if not loop.first %}&{% endif %}action(type="omfwd" target="{{ host['host'] }}" port="{{ host['port'] }}" protocol="{{ protocol }}" action.resumeRetryCount="{{ retry_count }}" action.resumeInterval="{{ retry_interval }}" queue.type="linkedList" queue.size="{{ queue_size }}" {% if not loop.first %}action.execOnlyWhenPreviousIsSuspended="on"{% endif %}){% endfor %}
|
||||
{% else %}
|
||||
local{{ admin_log_facility }}.* {% for host in admin_log_hosts %}{% if not loop.first %}&{% endif %}action(type="omfwd" target="{{ host['host'] }}" port="{{ host['port'] }}" protocol="{{ protocol }}" action.resumeRetryCount="{{ retry_count }}" action.resumeInterval="{{ retry_interval }}" queue.type="linkedList" queue.size="{{ queue_size }}" {% if not loop.first %}action.execOnlyWhenPreviousIsSuspended="on"{% endif %}){% endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if disable_local_log_storage -%}
|
||||
*.* stop
|
||||
{%- endif -%}
|
||||
|
@ -21,24 +21,21 @@ import octavia.tests.unit.base as base
|
||||
|
||||
|
||||
class LoggingJinjaTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(LoggingJinjaTestCase, self).setUp()
|
||||
|
||||
self.conf = oslo_fixture.Config(cfg.CONF)
|
||||
self.conf.config(debug=False)
|
||||
self.conf.config(
|
||||
def test_build_agent_config(self):
|
||||
conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
|
||||
conf.config(debug=False)
|
||||
conf.config(
|
||||
group="amphora_agent",
|
||||
admin_log_targets='192.0.2.17:10514,192.51.100.4:10514')
|
||||
self.conf.config(
|
||||
conf.config(
|
||||
group="amphora_agent",
|
||||
tenant_log_targets='192.0.2.7:20514,192.51.100.9:20514')
|
||||
self.conf.config(group="amphora_agent",
|
||||
conf.config(group="amphora_agent",
|
||||
log_protocol=lib_consts.PROTOCOL_UDP)
|
||||
self.conf.config(group="amphora_agent", log_retry_count=5)
|
||||
self.conf.config(group="amphora_agent", log_retry_interval=2)
|
||||
self.conf.config(group="amphora_agent", log_queue_size=10000)
|
||||
conf.config(group="amphora_agent", log_retry_count=5)
|
||||
conf.config(group="amphora_agent", log_retry_interval=2)
|
||||
conf.config(group="amphora_agent", log_queue_size=10000)
|
||||
|
||||
def test_build_agent_config(self):
|
||||
lj = logging_jinja_cfg.LoggingJinjaTemplater()
|
||||
expected_config = (
|
||||
u'local0.=info action(type="omfwd" target="192.0.2.7" '
|
||||
@ -59,3 +56,18 @@ class LoggingJinjaTestCase(base.TestCase):
|
||||
logging_cfg = lj.build_logging_config()
|
||||
|
||||
self.assertEqual(expected_config, logging_cfg)
|
||||
|
||||
def test_build_agent_config_disable_logs(self):
|
||||
conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
|
||||
conf.config(debug=False)
|
||||
conf.config(
|
||||
group="amphora_agent",
|
||||
disable_local_log_storage=True)
|
||||
|
||||
lj = logging_jinja_cfg.LoggingJinjaTemplater()
|
||||
expected_config = (
|
||||
u'*.* stop')
|
||||
|
||||
logging_cfg = lj.build_logging_config()
|
||||
|
||||
self.assertEqual(expected_config, logging_cfg)
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix an issue with the rsyslog configuration file in the Amphora when the
|
||||
log offloading feature and the local log storage feature are both disabled.
|
Loading…
Reference in New Issue
Block a user