Merge pull request #39 from elemoine/logrotate
Configure logrotate
diff --git a/collectd/_service.sls b/collectd/_service.sls
index f1689f8..7ced0b7 100644
--- a/collectd/_service.sls
+++ b/collectd/_service.sls
@@ -53,6 +53,16 @@
- require_in:
- file: {{ client.service }}_client_conf_dir_clean
+/etc/logrotate.d/{{ client.service }}:
+ file.managed:
+ - source: salt://collectd/files/collectd_logrotate.conf
+ - template: jinja
+ - defaults:
+ service_name: {{ client.service }}
+ - user: root
+ - group: root
+ - mode: 644
+
{%- endif %}
{{ client.config_dir }}/collectd_python.conf:
diff --git a/collectd/files/collectd_logrotate.conf b/collectd/files/collectd_logrotate.conf
new file mode 100644
index 0000000..f77e411
--- /dev/null
+++ b/collectd/files/collectd_logrotate.conf
@@ -0,0 +1,10 @@
+/var/log/{{ service_name }}.log {
+ rotate 5
+ daily
+ nocreate
+ missingok
+ compress
+ delaycompress
+ minsize 20M
+ maxsize 50M
+}