Add Octavia amphora logs to tripleo_logging_sources

When enabling the rsyslog forwarder in tripleo, the amphora logs are not
added to the rsyslog config. Add the 2 files if log offloading is
enabled, and also ensure that the files exist in the directory, rsyslog
skips the settings if they are missing, and they were created only when
a load balancer was spawned by Octavia

wallaby-backport-potential

Change-Id: I04c48371183c84d1c0f4295536c7c3e59483daad
This commit is contained in:
Gregory Thiemonge 2023-01-24 11:18:42 +01:00
parent 88de441153
commit 3c38d8a1a6
1 changed files with 23 additions and 1 deletions

View File

@ -120,7 +120,16 @@ outputs:
service_config_settings:
rsyslog:
tripleo_logging_sources_octavia_health_manager:
- {get_param: OctaviaHealthManagerLoggingSource}
list_concat:
- - {get_param: OctaviaHealthManagerLoggingSource}
- if:
- {get_param: OctaviaLogOffload}
- - tag: openstack.octavia.amphora
file: /var/log/containers/octavia-amphorae/octavia-amphora.log
startmsg.regex: "^[a-zA-Z]{3} [ 1-9][0-9] [:0-9]{8}"
- tag: openstack.octavia.tenant
file: /var/log/containers/octavia-amphorae/octavia-tenant-traffic.log
startmsg.regex: "^[a-zA-Z]{3} [ 1-9][0-9] [:0-9]{8}"
# BEGIN DOCKER SETTINGS #
puppet_config:
config_volume: octavia
@ -217,6 +226,19 @@ outputs:
with_items:
- { 'path': /var/log/containers/octavia, 'setype': container_file_t, 'mode': '0750' }
- { 'path': /var/log/containers/octavia-amphorae, 'setype': container_file_t, 'mode': '0750' }
# The tripleo rsyslog service is started before the amphora log files
# are created, rsyslog detects that the files are missing and skips the
# configuration of the forwarder. To fix this behavior, ensure that
# the log files exist.
- name: create empty log files
file:
path: "{{ item.path }}"
state: touch
setype: "{{ item.setype }}"
mode: "{{ item.mode }}"
with_items:
- { 'path': /var/log/containers/octavia-amphorae/octavia-tenant-traffic.log, 'setype': container_file_t, 'mode': '0644' }
- { 'path': /var/log/containers/octavia-amphorae/octavia-amphora.log, 'setype': container_file_t, 'mode': '0644' }
external_upgrade_tasks:
- when:
- step|int == 1