Browse Source

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)
(cherry picked from commit 29b8a69a89)
changes/15/761715/1
Michele Baldessari 3 months ago
parent
commit
ef2ebb18d1
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      deployment/memcached/memcached-container-puppet.yaml

+ 2
- 2
deployment/memcached/memcached-container-puppet.yaml View File

@ -138,7 +138,7 @@ outputs:
dport: 11211
proto: 'tcp'
source: {get_param: MemcachedIpSubnet}
memcached::logfile: '/var/log/memcached/memcached.log'
memcached::logstdout: true
service_config_settings:
collectd:
tripleo.collectd.plugins.memcached:
@ -156,7 +156,7 @@ outputs:
config_image: {get_param: ContainerMemcachedConfigImage}
kolla_config:
/var/lib/kolla/config_files/memcached.json:
command: bash -c $* -- eval source /etc/sysconfig/memcached; exec /usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS
command: bash -c $* -- eval source /etc/sysconfig/memcached; exec /usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS >> /var/log/memcached/memcached.log 2>&1
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"


Loading…
Cancel
Save