Fix Logstash 6 log rotation - Stable/Train

Logstash 6 introduced in Centos 8 in Train release comes with log4j2
configuration that does not remove old compressed logs after rotation
Log rotation config backported from Logstash 7 - Combination of Size
Based and Time Based policies. Deletion occurs after 30 days or
3000 MB log files size - whichever comes first.

Change-Id: Ib44f493aad0813a8aba916c7c353b60cab954b5f
(cherry picked from commit 15f2af1b02)
Closes-Bug: #1886975
This commit is contained in:
Bartosz Bezak 2020-07-13 08:37:25 +00:00
parent ce337806a3
commit 102ae176bf
2 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,15 @@ ENV JAVA_HOME /usr/lib/jvm/jre-11-openjdk/
COPY elasticsearch.repo /etc/yum.repos.d/
{{ macros.install_packages(logstash_packages | customizable("packages")) }}
# NOTE(bbezak): log-rotation/deletion config backported from logstash 7
# https://github.com/elastic/logstash/commit/1ea1d1982d4174868f8de6c09be2e695b3e6597c
RUN sed -i /etc/logstash/log4j2.properties \
-e '/appender.rolling.policies.size.size/a appender.rolling.strategy.type = DefaultRolloverStrategy\nappender.rolling.strategy.max = 30' \
-e '/appender.json_rolling.policies.size.size/a appender.json_rolling.strategy.type = DefaultRolloverStrategy\nappender.json_rolling.strategy.max = 30' \
-e '/appender.rolling_slowlog.policies.size.size/a appender.rolling_slowlog.strategy.type = DefaultRolloverStrategy\nappender.rolling_slowlog.strategy.max = 30' \
-e '/appender.json_rolling_slowlog.policies.size.size/a appender.json_rolling_slowlog.strategy.type = DefaultRolloverStrategy\nappender.json_rolling_slowlog.strategy.max = 30'
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Logstash 6 introduced in Centos 8 in Train release comes with log4j2
configuration that does not remove old compressed logs after rotation
https://github.com/elastic/logstash/issues/11883
Log rotation config backported from Logstash 7 - Combination of Size
Based and Time Based policies. Deletion occurs after 30 days or
3000 MB log files size - whichever comes first.