Compress logs about garbage collector for elasticsearch
continuous-integration/drone/push Build is passing Details

Whitout this improvement, this logs cannot be compressed:
/var/log/elasticsearch/gc.log.02
/var/log/elasticsearch/gc.log.29
/var/log/elasticsearch/gc.log.12
/var/log/elasticsearch/gc.log.18
This commit is contained in:
Bruno TATU 2021-02-11 12:31:30 +01:00
parent f717c31acc
commit a695bec780
1 changed files with 2 additions and 2 deletions

View File

@ -5,5 +5,5 @@ LOG_DIR=/var/log/elasticsearch
USER=elasticsearch
MAX_AGE={{ elasticsearch_log_rotate_days | mandatory }}
find ${LOG_DIR} -type f -user ${USER} \( -name "*.log.????-??-??" -o -name "*-????-??-??.log" \) -exec gzip --best {} \;
find ${LOG_DIR} -type f -user ${USER} \( -name "*.log.????-??-??.gz" -o -name "*-????-??-??.log.gz" \) -ctime +${MAX_AGE} -delete
find ${LOG_DIR} -type f -user ${USER} \( -name "*.log.??" -o -name "*.log.????-??-??" -o -name "*-????-??-??.log" \) -not -name "*.gz" -exec gzip --best {} \;
find ${LOG_DIR} -type f -user ${USER} \( -name "*.log.??.gz" -o -name "*.log.????-??-??.gz" -o -name "*-????-??-??.log.gz" \) -ctime +${MAX_AGE} -delete