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
(cherry picked from commit 3c38d8a1a6)
(cherry picked from commit b23bd17425)
(cherry picked from commit ccb6a9df26)
This commit is contained in:
Gregory Thiemonge 2023-01-24 11:18:42 +01:00
parent 96b3fd63bc
commit 5a8404a2b5
1 changed files with 24 additions and 1 deletions

View File

@ -108,7 +108,17 @@ outputs:
service_config_settings:
rsyslog:
tripleo_logging_sources_octavia_health_manager:
- {get_param: OctaviaHealthManagerLoggingSource}
list_concat:
- - {get_param: OctaviaHealthManagerLoggingSource}
- if:
- log_offload_enabled
- - 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
@ -207,6 +217,19 @@ outputs:
with_items:
- { 'path': /var/log/containers/octavia, 'setype': svirt_sandbox_file_t, 'mode': '0750' }
- { 'path': /var/log/containers/octavia-amphorae, 'setype': svirt_sandbox_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': svirt_sandbox_file_t, 'mode': '0644' }
- { 'path': /var/log/containers/octavia-amphorae/octavia-amphora.log, 'setype': svirt_sandbox_file_t, 'mode': '0644' }
external_upgrade_tasks:
- when:
- step|int == 1