Merge "Add logrotate meta configuration for Gnocchi"
diff --git a/gnocchi/meta/logrotate.yml b/gnocchi/meta/logrotate.yml
new file mode 100644
index 0000000..5a5cc08
--- /dev/null
+++ b/gnocchi/meta/logrotate.yml
@@ -0,0 +1,25 @@
+## Default: Daily rotation with 28 rotations kept
+{%- from "gnocchi/map.jinja" import server, client with context %}
+
+{%- if server.get('enabled', False) %}
+ {%- set log_interval = server.get('logrotate', {}).get('interval', 'daily') %}
+ {%- set log_rotation = server.get('logrotate', {}).get('rotate', 28) %}
+{%- elif client.get('enabled', False) %}
+ {%- set log_interval = client.get('logrotate', {}).get('interval', 'daily') %}
+ {%- set log_rotation = client.get('logrotate', {}).get('rotate', 28) %}
+{%- endif %}
+
+
+{%- if server.get('enabled', False) or client.get('enabled', False) %}
+job:
+ gnocchi-common:
+ - files:
+ - /var/log/gnocchi/*.log
+ options:
+ - {{ log_interval }}
+ - rotate: {{ log_rotation }}
+ - missingok
+ - compress
+ - delaycompress
+ - copytruncate
+{%- endif %}