Add logrotate
Related-Prod: PROD-35590
Change-Id: Ic93a4ae53b1809e8a131c72f39535b05e0b88138
diff --git a/ironic/meta/logrotate.yml b/ironic/meta/logrotate.yml
new file mode 100644
index 0000000..7294d2e
--- /dev/null
+++ b/ironic/meta/logrotate.yml
@@ -0,0 +1,23 @@
+{%- from "ironic/map.jinja" import api, conductor with context %}
+{%- if api.get('enabled', False) %}
+ {%- set log_interval = api.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = api.get('logrotate', {}).get('rotate', 8) %}
+{%- elif conductor.get('enabled', False) %}
+ {%- set log_interval = conductor.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = conductor.get('logrotate', {}).get('rotate', 8) %}
+{%- endif %}
+
+{%- if api.get('enabled', False) or conductor.get('enabled', False) %}
+job:
+ ironic-common:
+ - files:
+ - /var/log/ironic/*.log
+ options:
+ - {{ log_interval }}
+ - rotate: {{ log_rotation }}
+ - missingok
+ - compress
+ - delaycompress
+ - copytruncate
+ - notifempty
+{%- endif %}