Add logrotate meta configuration for Ceilometer
- parametrize interval and rotate
Related: PROD-29848
Change-Id: I13b327a6d4b87cf01baa3c259399b5f7f7a1df78
diff --git a/ceilometer/meta/logrotate.yml b/ceilometer/meta/logrotate.yml
new file mode 100644
index 0000000..457cc08
--- /dev/null
+++ b/ceilometer/meta/logrotate.yml
@@ -0,0 +1,25 @@
+## Default: Daily rotation with 28 rotations kept
+{%- from "ceilometer/map.jinja" import server, agent 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 agent.get('enabled', False) %}
+ {%- set log_interval = agent.get('logrotate', {}).get('interval', 'daily') %}
+ {%- set log_rotation = agent.get('logrotate', {}).get('rotate', 28) %}
+{%- endif %}
+
+{%- if server.get('enabled', False) or agent.get('enabled', False) %}
+job:
+ ceilometer-common:
+ - files:
+ - /var/log/ceilometer/*.log
+ options:
+ - {{ log_interval }}
+ - rotate: {{ log_rotation }}
+ - missingok
+ - compress
+ - delaycompress
+ - notifempty
+ - copytruncate
+{%- endif %}