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