Browse Source

Merge "Fix rsyslog configuration when disabling logs" into stable/train

changes/65/792965/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
d1a3479aa5
3 changed files with 35 additions and 13 deletions
  1. +5
    -0
      octavia/common/jinja/logging/templates/10-rsyslog.conf.template
  2. +25
    -13
      octavia/tests/unit/common/jinja/logging/test_logging_jinja_cfg.py
  3. +5
    -0
      releasenotes/notes/fix-error-in-rsyslog-config-a316a7856e1a847a.yaml

+ 5
- 0
octavia/common/jinja/logging/templates/10-rsyslog.conf.template View File

@ -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 -%}

+ 25
- 13
octavia/tests/unit/common/jinja/logging/test_logging_jinja_cfg.py View File

@ -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",
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_protocol=lib_consts.PROTOCOL_UDP)
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)

+ 5
- 0
releasenotes/notes/fix-error-in-rsyslog-config-a316a7856e1a847a.yaml View File

@ -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…
Cancel
Save