{"push_id":2645888941,"size":2,"distinct_size":2,"ref":"refs/heads/master","head":"220170dfb2b57a0e79f4d06d0edd9df47c113836","before":"5ad483ea0420c72e74b7e42d1485fa7f7c0abfc0","commits":[{"sha":"77d93f32873e740b0f04f323465ad14c044c896b","author":{"name":"Michele Baldessari","email":"47483730395cccb6448ad7313d5cedb48de25e40@acksyn.org"},"message":"Fix logrotate_crond issues\n\nSo currently the logrotate_crond container has a few issues issues:\nA) In the postrotate it matches pids multiple times and sends SIGHUPs multiple time to processes:\n    ======== /var/log/messages =====\n    Jun 3 09:01:15 overcloud-controller-0 logrotate-crond: kill -HUP 1575\n    Jun 3 09:01:15 overcloud-controller-0 rsyslogd: [origin software=\"rsyslogd\" swVersion=\"8.24.0\" x-pid=\"1575\" x-info=\"http://www.rsyslog.com\"] rsyslogd was HUPed\n    Jun 3 09:01:15 overcloud-controller-0 logrotate-crond: kill -HUP 1575\n    Jun 3 09:01:15 overcloud-controller-0 rsyslogd: [origin software=\"rsyslogd\" swVersion=\"8.24.0\" x-pid=\"1575\" x-info=\"http://www.rsyslog.com\"] rsyslogd was HUPed\n    Jun 3 09:01:15 overcloud-controller-0 logrotate-crond: kill -HUP 1575\n    Jun 3 09:01:15 overcloud-controller-0 rsyslogd: [origin software=\"rsyslogd\n...\n\nAdding sort -u in the pipeline of the postrotate script takes care of\nthat.\n\nB) The logrotate_crond container should not rotate logs for services\nrunning on the host outside of containers (i.e. rsyslog has its own\n/etc/logrotate.d/rsyslog rules). Doing so violates the principle of\nleast surprise.\n\nUsing 'lsof ..+D /var/log/containers' takes care of this as we won't\nmatch any non containerized processes\n\nC) The find command matches older files to be deleted but the SIGHUP is\nnever sent so we actually can end up in a situation where we remove a\nfile but the new one never gets created because the service does not get\na SIGHUP signal:\n\nls -la /var/log/containers/httpd/*/*\n-rw-r--r--. 1 root root 52046652 May 29 14:10 /var/log/containers/httpd/aodh-api/aodh_wsgi_access.log.1\n-rw-r--r--. 1 root root 0 May 24 19:14 /var/log/containers/httpd/aodh-api/aodh_wsgi_error.log\n-rw-r--r--. 1 root root 5894 May 24 19:14 /var/log/containers/httpd/aodh-api/error_log\n-rw-r--r--. 1 root root 50755274 May 29 14:10 /var/log/containers/httpd/cinder-api/cinder_wsgi_access.log.1\n-rw-r--r--. 1 root root 4138 May 25 11:58 /var/log/containers/httpd/cinder-api/cinder_wsgi_error.log\n-rw-r--r--. 1 root root 5894 May 24 19:13 /var/log/containers/httpd/cinder-api/error_log\n\nUsing 'lsof ..+D /var/log/containers' fixes this case as well because\nnow we correctly match the processes that have a deleted file that is\nopen and we send a proper SIGHUP to them.\n\nTested by doing the following:\n1) Logging rotation of containerized services (B, C)\n1.1) Stopped the keystone container\n1.2) Made the /var/log/container/keystone/keystone.log file 21M large\n1.3) Started the keystone container and observed that it was logging\n     correctly to /var/log/container/keystone/keystone.log\n1.4) Inside the logrotate_crond container we ran the following:\n/usr/sbin/logrotate -s /var/lib/logrotate/logrotate-crond.status /etc/logrotate-crond.conf\n1.5) We observed correct log rotation and keystone was notified via\nSIGHUP and started logging correctly:\n-rw-r--r--.  1 42425 42425 21628706 Jun 13 08:43 keystone.log.1\n-rw-r--r--.  1 42425 42425      999 Jun 13 08:43 keystone.log\n\n2) No SIGHUP to host processes (A)\n2.1) stopped rsyslog on the host and made one of its log files > 10M:\n-rw-r--r--. 1 root root 28M Jun 13 08:59 /var/log/messages\n2.2) restart rsyslog\n2.3) Ran the logrotation inside the container\n/usr/sbin/logrotate -s /var/lib/logrotate/logrotate-crond.status /etc/logrotate-crond.conf\n2.4) Observed that no SIGHUP was sent to rsyslog on the host\n\nCo-Authored-By: Damien Ciabrini <dciabrin@redhat.com>\n\nChange-Id: I5029a4b9c76268455812696290aaf82f1a0c2c23\nCloses-Bug: #1776533","distinct":true,"url":"https://api.github.com/repos/openstack/puppet-tripleo/commits/77d93f32873e740b0f04f323465ad14c044c896b"},{"sha":"220170dfb2b57a0e79f4d06d0edd9df47c113836","author":{"name":"Zuul","email":"824662dd828adcec0bfbb1c6955f2603475eeec7@review.openstack.org"},"message":"Merge \"Fix logrotate_crond issues\"","distinct":true,"url":"https://api.github.com/repos/openstack/puppet-tripleo/commits/220170dfb2b57a0e79f4d06d0edd9df47c113836"}]}
{"actor":{"display_login":"openstack-gerrit"}}