Parametrize logrotate meta config, add client logs
Related: PROD-29848
Change-Id: Ic5c99462b8e670f7c72dba81b8a43795ac654eb4
diff --git a/glusterfs/meta/logrotate.yml b/glusterfs/meta/logrotate.yml
index f4dfe90..69f703d 100644
--- a/glusterfs/meta/logrotate.yml
+++ b/glusterfs/meta/logrotate.yml
@@ -1,8 +1,9 @@
-{%- from "glusterfs/map.jinja" import server with context %}
-{%- if server.get('enabled') %}
+{%- from "glusterfs/map.jinja" import server, client with context %}
job:
glusterfs:
- - files:
+{%- if server.get('enabled', False) %}
+ -
+ files:
- /var/log/glusterfs/cmd_history.log
- /var/log/glusterfs/srv-volumes-backup.log
- /var/log/glusterfs/cli.log
@@ -10,9 +11,49 @@
- /var/log/glusterfs/etc-glusterfs-glusterd.vol.log
- /var/log/glusterfs/**/*.log
options:
- - daily
- - rotate: {{ server.get('logrotate', {}).get('options', {}).get('rotate', 4) }}
+ - {{ server.get('logrotate', {}).get('interval', 'daily') }}
+ - rotate: {{ server.get('logrotate', {}).get('rotate', 14) }}
- compress
- delaycompress
- notifempty
{%- endif %}
+{%- if client.get('enabled', False) %}
+ -
+ files:
+ - /var/log/glusterfs/*.log
+ options:
+ - sharedscripts
+ - {{ client.get('logrotate', {}).get('interval', 'weekly') }}
+ - rotate: {{ client.get('logrotate', {}).get('rotate', 52) }}
+ - missingok
+ - compress
+ - delaycompress
+ - notifempty
+ - postrotate:
+ /usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true;
+ /usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
+{%- endif %}
+{%- if server.get('enabled', False) or client.get('enabled', False) %}
+{%- if server.get('enabled', False) %}
+ {%- set log_interval = server.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = server.get('logrotate', {}).get('rotate', 52) %}
+{%- elif client.get('enabled', False) %}
+ {%- set log_interval = client.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = client.get('logrotate', {}).get('rotate', 52) %}
+{%- endif %}
+ glusterfs-georep:
+ -
+ files:
+ - /var/log/glusterfs/geo-replication-slaves/*.log
+ - /var/log/glusterfs/geo-replication-slaves/*/*.log
+ options:
+ - sharedscripts
+ - {{ log_interval }}
+ - rotate: {{ log_rotation }}
+ - missingok
+ - compress
+ - delaycompress
+ - notifempty
+ - postrotate:
+ for pid in `ps -aef | grep glusterfs | egrep "\-\-aux-gfid-mount" | awk '{print $2}'`; do /usr/bin/kill -HUP $pid > /dev/null 2>&1 || true; done
+{%- endif %}