Merge "[Octavia] Create a rsyslog forward when *_log_targets params are set" into stable/train

This commit is contained in:
Zuul 2023-01-30 15:41:40 +00:00 committed by Gerrit Code Review
commit b14f4bb1b0
2 changed files with 29 additions and 0 deletions

View File

@ -113,5 +113,7 @@
octavia_confd_prefix: "/var/lib/config-data/puppet-generated/octavia"
container_cli: "{{ container_cli }}"
enable_log_offloading: "{{ enable_log_offloading }}"
admin_log_targets: "{{ octavia_admin_log_targets | default([]) }}"
tenant_log_targets: "{{ octavia_tenant_log_targets | default([]) }}"
roles:
- octavia-controller-post-config

View File

@ -1,14 +1,41 @@
module(load="imudp")
input(type="imudp" address="{{ mgmt_port_ip }}" port="514")
{% macro forwarder(type, log_targets) %}
{% if (log_targets|length) > 0 %}
ruleset(name="{{ type }}_forwarding" queue.type="linkedList" queue.size="10000") {
{% for target in log_targets %}
action(type="omfwd"
{%- set host, port = target.split(':') -%}
target="{{ host }}"
port="{{ port }}"
protocol="udp"
action.resumeRetryCount="5"
action.resumeInterval="2"
{% if not loop.first %}action.execOnlyWhenPreviousIsSuspended="on"{%- endif %}
)
{% endfor %}
}
{% endif %}
{% endmacro %}
{{ forwarder('tenant', tenant_log_targets) }}
{{ forwarder('admin', admin_log_targets) }}
# Output the amphora tenant traffic flow logs
if ($inputname == "imudp" and $syslogfacility-text == "local0" and $syslogseverity-text == "info" and $hostname startswith "amphora") then {
action(type="omfile" FileCreateMode="0644" File="/var/log/octavia/octavia-tenant-traffic.log")
{% if (tenant_log_targets|length) > 0 %}
call tenant_forwarding
{% endif %}
stop
}
# Output the amphora administrative logs
if ($inputname == "imudp" and $syslogfacility-text == "local1" and $hostname startswith "amphora") then {
action(type="omfile" FileCreateMode="0644" File="/var/log/octavia/octavia-amphora.log")
{% if (admin_log_targets|length) > 0 %}
call admin_forwarding
{% endif %}
stop
}