Add logrotate meta configuration for MongoDB
- parametrize interval and rotate
Related: PROD-29848
Change-Id: Icdedc37708b93ff16e3aa4a2a2b4aca5a718f36b
diff --git a/mongodb/meta/logrotate.yml b/mongodb/meta/logrotate.yml
new file mode 100644
index 0000000..92ec646
--- /dev/null
+++ b/mongodb/meta/logrotate.yml
@@ -0,0 +1,17 @@
+## Default: Weekly rotation with 10 rotations kept
+{%- from "mongodb/map.jinja" import server with context %}
+
+{%- if server.get('enabled', False) %}
+job:
+ mongodb-server:
+ - files:
+ - /var/log/mongodb/*.log
+ options:
+ - {{ server.get('logrotate', {}).get('interval', 'weekly') }}
+ - rotate: {{ server.get('logrotate', {}).get('rotate', 10) }}
+ - copytruncate
+ - delaycompress
+ - compress
+ - notifempty
+ - missingok
+{%- endif %}