[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
This commit is contained in:
parent
53504ed7be
commit
80b62a18ce
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue