tripleo-heat-templates/deployment/memcached
Michele Baldessari 29b8a69a89 Fix memcached logging
Even though we're setting memcached::logfile:
'/var/log/memcached/memcached.log' there are no logs created in
/var/log/containers/memcached.

The reason for this is that memcached::logfile in puppet-memcached
simply adds a shell redirect to a file. These redirecs are
passed by tht and kolla to the memcached process invocation as parameters
of memcached and so are not read being read by the shell process
and nothing gets redirected. That is why we observe that on a broken
container the redirections are arguments to memcached:

[root@controller-0 ~]# ps aux | grep memcache | grep -v containers
    42457     358189  0.0  0.0 744088 10960 ?        Sl   15:21   0:00 /usr/bin/memcached -p 11211 -u memcached -m 16000 -c 8192 -vv -l 172.17.1.138 -U 0 -X -t 8 >> /var/log/memcached/memcached.log 2>&1

Fix this by forcing memcached to log on stdout and at the same
time creating the redirect on the shell parameters that invoke
memcached.

Tested on a Train environment and I correctly get:
1) Proper logging
[root@controller-0 ~]# ls -l /var/log/containers/memcached/memcached.log
-rw-r--r--. 1 42457 42457 29086 Nov  4 18:00 /var/log/containers/memcached/memcached.log

2) No unused redirections inside the memcached process:
[root@controller-0 ~]# podman exec -it -uroot memcached ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
memcach+       1       0  0 18:47 ?        00:00:00 dumb-init --single-child -- kolla_start
memcach+       6       1  0 18:47 ?        00:00:00 /usr/bin/memcached -p 11211 -u memcached -m 9953 -c 8192 -vv -l 172.17.1.50 -U 0 -X -t 4

Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>

Resolves: #1902922

NB: Slight conflict when cherry-picking due to different context

Change-Id: If5487c9be745ebd6bc3ebe172e28dc59e6855188
(cherry picked from commit a9da212d7d)
(cherry picked from commit d7d9e05ff8)
2020-11-06 09:13:46 +01:00
..
memcached-container-puppet.yaml Fix memcached logging 2020-11-06 09:13:46 +01:00