Create a dedicated log file for healthchecks for collectd
This is a first step in order to get rid of the journalctl/systemctl calls from within collectd container. If CollectdEnableSensubility is set to true, the configuration will be added, and if set to false, it will remove it. The latter is in order to ensure we don't risk any disk space issue in case the operator wants to remove this feature. It depends on two patches that actually enable the SyslogIdentifier configuration in the healthcheck units. Change-Id: If4414c6ceced9200f9b0dc97be5043d7b2684ae1 Closes-Bug: #1856575 Depends-On: Icdc5caf4cedc46291a807c39c0a31c74955a4a74 Depends-On: I6861baa287f2a8288b87be26aacecbcc061cd96f
This commit is contained in:
parent
de7ab6ad38
commit
122929c21e
|
@ -636,6 +636,44 @@ outputs:
|
|||
- /usr/lib/systemd/system:/usr/lib/systemd/system:ro
|
||||
environment:
|
||||
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
||||
deploy_steps_tasks:
|
||||
- name: set enable_sensubility fact
|
||||
set_fact:
|
||||
enable_sensubility: {get_param: CollectdEnableSensubility}
|
||||
- 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
|
||||
when:
|
||||
- enable_sensubility|bool
|
||||
register: logconfig_add
|
||||
copy:
|
||||
dest: /etc/rsyslog.d/openstack-healthcheck.conf
|
||||
content: |
|
||||
if $programname startswith 'healthcheck_' then -/var/log/containers/collectd/healthchecks.log
|
||||
& stop
|
||||
- name: Remove healthcheck log
|
||||
when:
|
||||
- not enable_sensubility|bool
|
||||
register: logconfig_rm
|
||||
file:
|
||||
path: /etc/rsyslog.d/openstack-healthcheck.conf
|
||||
state: absent
|
||||
- name: Reload rsyslogd if needed
|
||||
when: logconfig_add is changed or logconfig_rm is changed
|
||||
service:
|
||||
name: rsyslog
|
||||
state: restarted
|
||||
host_prep_tasks:
|
||||
- name: create persistent directories
|
||||
file:
|
||||
|
|
Loading…
Reference in New Issue