From 79b59e2c0b43936a12a9c676d8a48cd62c733a0f Mon Sep 17 00:00:00 2001 From: Isaac Prior Date: Thu, 24 Jun 2021 14:12:48 +0100 Subject: [PATCH] Fix log rotation for fluentd created files Overrides default fluentd buffer config to stop log files from using datestamped filenames, allowing logrotate to manage them. Closes-Bug: #1940118 Change-Id: I40c4e209470d21e0a02fd447fb628acfdae9fa9d --- .../templates/conf/output/00-local.conf.j2 | 53 +++++++++++-------- .../templates/cron-logrotate-haproxy.conf.j2 | 2 +- ...ix-haproxy-logrotate-e299a0000728fd8f.yaml | 12 +++++ 3 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 releasenotes/notes/fix-haproxy-logrotate-e299a0000728fd8f.yaml diff --git a/ansible/roles/common/templates/conf/output/00-local.conf.j2 b/ansible/roles/common/templates/conf/output/00-local.conf.j2 index ba46b519bd..4b8067e0db 100644 --- a/ansible/roles/common/templates/conf/output/00-local.conf.j2 +++ b/ansible/roles/common/templates/conf/output/00-local.conf.j2 @@ -3,11 +3,11 @@ @type copy @type file - path /var/log/kolla/swift/swift_latest.*.log + path /var/log/kolla/swift/swift_latest append true - compress gzip - - timekey_use_utc + # Disable timestamp in filename for logs + + path /var/log/kolla/swift/swift_latest.*.buffer {% if log_direct_to_elasticsearch %} @@ -66,14 +66,17 @@ @type copy @type file - path /var/log/kolla/haproxy/haproxy_latest.*.log - output_tag false - output_time false + path /var/log/kolla/haproxy/haproxy_latest append true - compress gzip - - timekey_use_utc + # Disable timestamp in filename for logs + + path /var/log/kolla/haproxy/haproxy_latest.*.buffer + # Don't prepend syslog tag or timestamp to log output + + output_tag false + output_time false + {% if log_direct_to_elasticsearch %} @@ -131,14 +134,17 @@ @type copy @type file - path /var/log/kolla/glance-tls-proxy/glance-tls-proxy.*.log - output_tag false - output_time false + path /var/log/kolla/glance-tls-proxy/glance-tls-proxy append true - compress gzip - - timekey_use_utc + # Disable timestamp in filename for logs + + path /var/log/kolla/glance-tls-proxy/glance-tls-proxy.*.buffer + # Don't prepend syslog tag or timestamp to log output + + output_tag false + output_time false + {% if log_direct_to_elasticsearch %} @@ -193,14 +199,17 @@ @type copy @type file - path /var/log/kolla/neutron-tls-proxy/neutron-tls-proxy.*.log - output_tag false - output_time false + path /var/log/kolla/neutron-tls-proxy/neutron-tls-proxy append true - compress gzip - - timekey_use_utc + # Disable timestamp in filename for logs + + path /var/log/kolla/neutron-tls-proxy/neutron-tls-proxy.*.buffer + # Don't prepend syslog tag or timestamp to log output + + output_tag false + output_time false + {% if log_direct_to_elasticsearch %} diff --git a/ansible/roles/common/templates/cron-logrotate-haproxy.conf.j2 b/ansible/roles/common/templates/cron-logrotate-haproxy.conf.j2 index 7af26dd38b..3e89a2e751 100644 --- a/ansible/roles/common/templates/cron-logrotate-haproxy.conf.j2 +++ b/ansible/roles/common/templates/cron-logrotate-haproxy.conf.j2 @@ -1,3 +1,3 @@ -"/var/log/kolla/haproxy/haproxy.log" +"/var/log/kolla/haproxy/*.log" { } diff --git a/releasenotes/notes/fix-haproxy-logrotate-e299a0000728fd8f.yaml b/releasenotes/notes/fix-haproxy-logrotate-e299a0000728fd8f.yaml new file mode 100644 index 0000000000..d2c1ad6056 --- /dev/null +++ b/releasenotes/notes/fix-haproxy-logrotate-e299a0000728fd8f.yaml @@ -0,0 +1,12 @@ +--- +issues: + - | + Existing fluentd log rotation failed to delete old haproxy, swift, + glance-tls-proxy and neutron-tls-proxy logs. These will not be + deleted by the new logrotate config and will have to be removed + manually. +fixes: + - | + Existing fluentd log rotation failed to delete old haproxy, swift, + glance-tls-proxy and neutron-tls-proxy logs. Standardise rotation + and deletion of logs using logrotate.