From 80b62a18cee13093bc49929b7b49503b3b665aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Jeanneret?= Date: Wed, 8 Jan 2020 16:23:04 +0100 Subject: [PATCH] [Stein-Only] Create a dedicated log file for healthchecks for collectd This is the Stein equivalent of https://review.opendev.org/701187. It creates a dedicated log file for the container healthchecks if we're running with podman container engine, and activate sensu client. It depends on a patch that actually add a new log identifier for the container healthcheck systemd units. Change-Id: I7143ba61f86263bba2fcd1013c74b075ac0d08b7 Closes-Bug: #1856575 Depends-On: https://review.opendev.org/701523 --- .../sensu-client-container-puppet.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/deployment/deprecated/monitoring/sensu-client-container-puppet.yaml b/deployment/deprecated/monitoring/sensu-client-container-puppet.yaml index a42c9f482a..e688690e25 100644 --- a/deployment/deprecated/monitoring/sensu-client-container-puppet.yaml +++ b/deployment/deprecated/monitoring/sensu-client-container-puppet.yaml @@ -231,6 +231,37 @@ outputs: Log files from sensu containers can be found under /var/log/containers/sensu. ignore_errors: true + deploy_steps_tasks: + # This code is only valid for podman container engine. + if: + - docker_enabled + - null + - + - name: Configure rsyslog for container healthchecks + when: + - step|int == 1 + block: + - name: Check if rsyslog exists + shell: systemctl list-unit-files --type=service | grep -q rsyslog + register: rsyslog_config + failed_when: rsyslog_config.rc == 2 + - name: Configure if we can + when: + - rsyslog_config is changed + - rsyslog_config.rc == 0 + block: + - name: Log healthchecks in dedicated file + register: logconfig_add + copy: + dest: /etc/rsyslog.d/openstack-healthcheck.conf + content: | + if $programname startswith 'healthcheck_' then -/var/log/containers/sensu/healthchecks.log + & stop + - name: Reload rsyslogd if needed + when: logconfig_add is changed + service: + name: rsyslog + state: restarted # TODO: Removal of package upgrade_tasks: [] post_upgrade_tasks: