Add logrotate meta configuration for Octavia
- parametrize interval and rotate
Related: PROD-29848
Change-Id: I038354d50bbd74c11a1b1ee2522ba5ce2286e019
(cherry picked from commit 1f5ce61710db721d8f98fd8545ec260c35b66d5f)
diff --git a/octavia/meta/logrotate.yml b/octavia/meta/logrotate.yml
new file mode 100644
index 0000000..a119942
--- /dev/null
+++ b/octavia/meta/logrotate.yml
@@ -0,0 +1,24 @@
+## Default: Weekly rotation with 14 rotations kept
+{%- from "octavia/map.jinja" import manager, client with context %}
+
+{%- if manager.get('enabled', False) %}
+ {%- set log_interval = manager.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = manager.get('logrotate', {}).get('rotate', 14) %}
+{%- elif client.get('enabled', False) %}
+ {%- set log_interval = client.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = client.get('logrotate', {}).get('rotate', 14) %}
+{%- endif %}
+
+{%- if manager.get('enabled', False) or client.get('enabled', False) %}
+job:
+ openstack-octavia:
+ - files:
+ - /var/log/octavia/*.log
+ options:
+ - {{ log_interval }}
+ - rotate: {{ log_rotation }}
+ - size: 10M
+ - missingok
+ - compress
+ - copytruncate
+{%- endif %}