Merge "Fix Amphora RSyslog configuration for TCP failover"
This commit is contained in:
@@ -15,17 +15,41 @@
|
|||||||
#}
|
#}
|
||||||
{#- Tenant traffic logs -#}
|
{#- Tenant traffic logs -#}
|
||||||
{%- if tenant_log_hosts -%}
|
{%- 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 %}
|
ruleset(name="tenant_forwarding" queue.type="linkedList" queue.size="{{ queue_size }}") {
|
||||||
{%- endif -%}
|
{%- for host in tenant_log_hosts %}
|
||||||
|
action(type="omfwd"
|
||||||
|
target="{{ host['host'] }}"
|
||||||
|
port="{{ host['port'] }}"
|
||||||
|
protocol="{{ protocol }}"
|
||||||
|
action.resumeRetryCount="{{ retry_count }}"
|
||||||
|
action.resumeInterval="{{ retry_interval }}"
|
||||||
|
{% if not loop.first %}action.execOnlyWhenPreviousIsSuspended="on"{%- endif -%}
|
||||||
|
)
|
||||||
|
{%- endfor %}
|
||||||
|
}
|
||||||
|
local{{ user_log_facility }}.=info call tenant_forwarding
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{#- Administrative logs -#}
|
{#- Administrative logs -#}
|
||||||
{%- if admin_log_hosts -%}
|
{% if admin_log_hosts %}
|
||||||
|
ruleset(name="admin_forwarding" queue.type="linkedList" queue.size="{{ queue_size }}") {
|
||||||
|
{%- for host in admin_log_hosts %}
|
||||||
|
action(type="omfwd"
|
||||||
|
target="{{ host['host'] }}"
|
||||||
|
port="{{ host['port'] }}"
|
||||||
|
protocol="{{ protocol }}"
|
||||||
|
action.resumeRetryCount="{{ retry_count }}"
|
||||||
|
action.resumeInterval="{{ retry_interval }}"
|
||||||
|
{% if not loop.first %}action.execOnlyWhenPreviousIsSuspended="on"{%- endif -%}
|
||||||
|
)
|
||||||
|
{%- endfor %}
|
||||||
|
}
|
||||||
{%- if forward_all_logs %}
|
{%- 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 %}
|
*.*;local{{ user_log_facility }}.none call admin_forwarding
|
||||||
{% else %}
|
{% 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 -%}
|
local{{ admin_log_facility }}.* call admin_forwarding
|
||||||
{%- endif -%}
|
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if disable_local_log_storage -%}
|
{%- if disable_local_log_storage -%}
|
||||||
*.* stop
|
*.* stop
|
||||||
|
@@ -38,21 +38,44 @@ class LoggingJinjaTestCase(base.TestCase):
|
|||||||
|
|
||||||
lj = logging_jinja_cfg.LoggingJinjaTemplater()
|
lj = logging_jinja_cfg.LoggingJinjaTemplater()
|
||||||
expected_config = (
|
expected_config = (
|
||||||
u'local0.=info action(type="omfwd" target="192.0.2.7" '
|
'ruleset(name="tenant_forwarding" queue.type="linkedList" '
|
||||||
'port="20514" protocol="UDP" action.resumeRetryCount="5" '
|
'queue.size="10000") {\n'
|
||||||
'action.resumeInterval="2" queue.type="linkedList" '
|
' action(type="omfwd"\n'
|
||||||
'queue.size="10000" )&action(type="omfwd" target="192.51.100.9" '
|
' target="192.0.2.7"\n'
|
||||||
'port="20514" protocol="UDP" action.resumeRetryCount="5" '
|
' port="20514"\n'
|
||||||
'action.resumeInterval="2" queue.type="linkedList" '
|
' protocol="UDP"\n'
|
||||||
'queue.size="10000" action.execOnlyWhenPreviousIsSuspended="on")\n'
|
' action.resumeRetryCount="5"\n'
|
||||||
'local1.* action(type="omfwd" target="192.0.2.17" port="10514" '
|
' action.resumeInterval="2"\n'
|
||||||
'protocol="UDP" action.resumeRetryCount="5" '
|
' )\n'
|
||||||
'action.resumeInterval="2" queue.type="linkedList" '
|
' action(type="omfwd"\n'
|
||||||
'queue.size="10000" )&action(type="omfwd" target="192.51.100.4" '
|
' target="192.51.100.9"\n'
|
||||||
'port="10514" protocol="UDP" action.resumeRetryCount="5" '
|
' port="20514"\n'
|
||||||
'action.resumeInterval="2" queue.type="linkedList" '
|
' protocol="UDP"\n'
|
||||||
'queue.size="10000" action.execOnlyWhenPreviousIsSuspended="on")')
|
' action.resumeRetryCount="5"\n'
|
||||||
|
' action.resumeInterval="2"\n'
|
||||||
|
' action.execOnlyWhenPreviousIsSuspended="on")\n'
|
||||||
|
'}\n'
|
||||||
|
'local0.=info call tenant_forwarding\n'
|
||||||
|
'\n'
|
||||||
|
'ruleset(name="admin_forwarding" queue.type="linkedList" '
|
||||||
|
'queue.size="10000") {\n'
|
||||||
|
' action(type="omfwd"\n'
|
||||||
|
' target="192.0.2.17"\n'
|
||||||
|
' port="10514"\n'
|
||||||
|
' protocol="UDP"\n'
|
||||||
|
' action.resumeRetryCount="5"\n'
|
||||||
|
' action.resumeInterval="2"\n'
|
||||||
|
' )\n'
|
||||||
|
' action(type="omfwd"\n'
|
||||||
|
' target="192.51.100.4"\n'
|
||||||
|
' port="10514"\n'
|
||||||
|
' protocol="UDP"\n'
|
||||||
|
' action.resumeRetryCount="5"\n'
|
||||||
|
' action.resumeInterval="2"\n'
|
||||||
|
' action.execOnlyWhenPreviousIsSuspended="on")\n'
|
||||||
|
'}\n'
|
||||||
|
'local1.* call admin_forwarding'
|
||||||
|
)
|
||||||
logging_cfg = lj.build_logging_config()
|
logging_cfg = lj.build_logging_config()
|
||||||
|
|
||||||
self.assertEqual(expected_config, logging_cfg)
|
self.assertEqual(expected_config, logging_cfg)
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The generated RSyslog configuration on the amphora supports now
|
||||||
|
RSyslog failover with TCP if multiple RSyslog servers were specified.
|
Reference in New Issue
Block a user