Merge "Add support for Octavia amphora log offloading" into stable/ussuri

This commit is contained in:
Zuul 2020-06-10 23:25:22 +00:00 committed by Gerrit Code Review
commit af05e1917d
4 changed files with 71 additions and 0 deletions

View File

@ -95,5 +95,6 @@
vars: vars:
octavia_confd_prefix: "/var/lib/config-data/puppet-generated/octavia" octavia_confd_prefix: "/var/lib/config-data/puppet-generated/octavia"
container_cli: "{{ container_cli }}" container_cli: "{{ container_cli }}"
enable_log_offloading: "{{ enable_log_offloading }}"
roles: roles:
- octavia_controller_post_config - octavia_controller_post_config

View File

@ -17,3 +17,4 @@ lb_mgmt_subnet_pool_end: "172.24.255.254"
lb_mgmt_sec_grp_name: "lb-mgmt-sec-grp" lb_mgmt_sec_grp_name: "lb-mgmt-sec-grp"
lb_health_mgr_sec_grp_name: "lb-health-mgr-sec-grp" lb_health_mgr_sec_grp_name: "lb-health-mgr-sec-grp"
mgmt_port_dev: "o-hm0" mgmt_port_dev: "o-hm0"
enable_log_offloading: false

View File

@ -14,6 +14,35 @@
set_fact: set_fact:
o_hm_ip_list: "{{ o_hm_ip_list[:-2] }}" o_hm_ip_list: "{{ o_hm_ip_list[:-2] }}"
- name: configure amphora log offloading
block:
- name: create ip list (rsyslog)
set_fact:
o_rsyslog_ip_list: "{% for octavia_node in groups['octavia_nodes'] %}{{ hostvars[octavia_node].mgmt_port_ip }}:514, {%endfor%}"
- name: create ip list (remove the last two characters) (rsyslog)
set_fact:
o_rsyslog_ip_list: "{{ o_rsyslog_ip_list[:-2] }}"
- name: create /etc/rsyslog.d
become: true
become_user: root
file:
state: directory
path: "{{ octavia_confd_prefix }}/etc/rsyslog.d"
selevel: s0
setype: svirt_sandbox_file_t
- name: create rsyslog 10-octavia.conf
become: true
become_user: root
template:
src: templates/10-octavia.conf.j2
dest: "{{ octavia_confd_prefix }}/etc/rsyslog.d/10-octavia.conf"
selevel: s0
setype: svirt_sandbox_file_t
when: enable_log_offloading | bool
- name: read the current IP list - name: read the current IP list
become: true become: true
become_user: root become_user: root
@ -48,6 +77,32 @@
when: when:
- octavia_config_updated - octavia_config_updated
- name: setting [amphora_agent]/tenant_log_targets
become: true
become_user: root
ini_file:
section: "amphora_agent"
option: "tenant_log_targets"
value: "{{ o_rsyslog_ip_list }}"
path: "{{ octavia_confd_prefix }}/etc/octavia/post-deploy.conf"
selevel: s0
setype: svirt_sandbox_file_t
when:
- enable_log_offloading | bool
- name: setting [amphora_agent]/admin_log_targets
become: true
become_user: root
ini_file:
section: "amphora_agent"
option: "admin_log_targets"
value: "{{ o_rsyslog_ip_list }}"
path: "{{ octavia_confd_prefix }}/etc/octavia/post-deploy.conf"
selevel: s0
setype: svirt_sandbox_file_t
when:
- enable_log_offloading | bool
- name: get list of running octavia services - name: get list of running octavia services
become: true become: true
become_user: root become_user: root

View File

@ -0,0 +1,14 @@
module(load="imudp")
input(type="imudp" address="{{ mgmt_port_ip }}" port="514")
# 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")
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")
stop
}