From a5e278ea9ec1b272268c43758d203b01206ea0ab Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Tue, 28 Jan 2020 17:03:28 +0100 Subject: [PATCH] Fix keepalived logging on disk There are no logs under /var/log/containers/keepalived even though we explicitly try to capture logs on file for the keepalived container: [root@undercloud-0 ~]# podman exec -it keepalived sh -c 'ps -ax' PID TTY STAT TIME COMMAND 1 ? Ss 0:00 dumb-init --single-child -- /usr/local/bin/kolla_start 8 ? S 0:00 /usr/sbin/keepalived -nldD | tee -a /var/log/keepalived.log 12 ? S 2:18 /usr/sbin/keepalived -nldD | tee -a /var/log/keepalived.log The reason this is broken is that 'tee' is not passed to a shell but ends up being an ignored argument of keepalived. Notice how there is no shell process and also no tee process in the container above. To fix that we need to pass the proper commands to a shell. This is done in a special way like we did for the haproxy container so that kolla does not mangle quotes and spaces. After this fix we correctly see that the container logs on disk: [root@undercloud-0 container-puppet]# ls -l /var/log/containers/keepalived/ -rw-r--r--. 1 root root 17483 Jan 28 15:55 keepalived.log While we're at it we remove the usage of tee. It makes no sense to log both on file and on stdout/stderr. Co-Authored-By: Damien Ciabrini Change-Id: Id309e812f7dc8d66bd4912fce282ce72350fcbf8 Closes-Bug: #1861169 (cherry picked from commit 547a510f63e9e7aa2cd41e050c94fc7077fb86f4) --- deployment/keepalived/keepalived-container-puppet.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/keepalived/keepalived-container-puppet.yaml b/deployment/keepalived/keepalived-container-puppet.yaml index 67f544f5db..1bdaa786d7 100644 --- a/deployment/keepalived/keepalived-container-puppet.yaml +++ b/deployment/keepalived/keepalived-container-puppet.yaml @@ -100,7 +100,7 @@ outputs: config_image: {get_param: ContainerKeepalivedConfigImage} kolla_config: /var/lib/kolla/config_files/keepalived.json: - command: /usr/sbin/keepalived -nldD | tee -a /var/log/keepalived.log + command: "/bin/bash -c $* -- eval exec /usr/sbin/keepalived -nldD &>>/var/log/keepalived.log" config_files: - source: "/var/lib/kolla/config_files/src/*" dest: "/"