elasticsearch : use logrotate for garbage collector logs
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
This commit is contained in:
parent
8401401716
commit
48e3ced983
5 changed files with 35 additions and 2 deletions
|
@ -23,6 +23,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
|||
|
||||
* Proper jinja spacing
|
||||
* evolinux-base: ensure dbus is started and enabled (not by default in the case of an offline netinst)
|
||||
* elasticsearch : use logrotate for garbage collector logs instead of breaking compression cron
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -118,6 +118,18 @@
|
|||
tags:
|
||||
- config
|
||||
|
||||
- name: Garbage collector logs rotation by the JVM is disabled
|
||||
lineinfile:
|
||||
dest: /etc/elasticsearch/jvm.options.d/evolinux.options
|
||||
regexp: "^-Xlog:gc"
|
||||
line: "-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=0"
|
||||
create: yes
|
||||
owner: root
|
||||
group: elasticsearch
|
||||
mode: "0640"
|
||||
tags:
|
||||
- config
|
||||
|
||||
- name: Configure cluster members
|
||||
lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
|
|
|
@ -17,3 +17,12 @@
|
|||
group: root
|
||||
mode: "0750"
|
||||
when: is_cron_installed.rc == 0
|
||||
|
||||
- name: "Setup logrotate for JVM garbage collector"
|
||||
template:
|
||||
src: logrotate.j2
|
||||
dest: /etc/logrotate/elasticsearch
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: is_cron_installed.rc == 0
|
||||
|
|
12
elasticsearch/templates/logrotate.j2
Normal file
12
elasticsearch/templates/logrotate.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
/var/log/elasticsearch/gc.log {
|
||||
su elasticsearch elasticsearch
|
||||
daily
|
||||
rotate {{ elasticsearch_log_rotate_days }}
|
||||
compress
|
||||
nodelaycompress
|
||||
missingok
|
||||
copytruncate
|
||||
dateext
|
||||
dateformat .%Y-%m-%d
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ MAX_AGE={{ elasticsearch_log_rotate_days | mandatory }}
|
|||
# Compress logs
|
||||
find ${LOG_DIR} -type f -user ${USER} -name "*.log.????-??-??" -exec gzip --best {} \;
|
||||
find ${LOG_DIR} -type f -user ${USER} -name "*-????-??-??.log" -exec gzip --best {} \;
|
||||
find ${LOG_DIR} -type f -user ${USER} -name "*.log.??" -not -name "*.gz" -exec gzip --best {} \;
|
||||
|
||||
# Delete old logs
|
||||
find ${LOG_DIR} -type f -user ${USER} -name "*gz" -ctime +${MAX_AGE} -delete
|
||||
find ${LOG_DIR} -type f -user ${USER} -name "*gz" -ctime +${MAX_AGE} -delete
|
||||
|
|
Loading…
Add table
Reference in a new issue