From 9e6956d9c09f4aee70971080eb332d9288521c5b Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Thu, 7 Dec 2023 13:04:45 +0100 Subject: [PATCH] initial commit --- logrot.cf | 7 ++++++- templates/httpd-weblogrot-matomo.mustache | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 templates/httpd-weblogrot-matomo.mustache diff --git a/logrot.cf b/logrot.cf index 9403b20..95881f0 100644 --- a/logrot.cf +++ b/logrot.cf @@ -10,16 +10,21 @@ vars: }; freebsd:: "dir" string => "/usr/local/etc/logrotate.d"; + "cmd" string => "/usr/local/sbin/logrotate"; + "conf" string => "/usr/local/etc/logrotate.conf"; debian:: "dir" string => "/etc/logrotate.d"; centos:: "dir" string => "/etc/logrotate.d"; + } bundle agent install_logrot { methods: - "any" usebundle => wmde_install_packages(@(logrot.pkgs),"logrot"); + "any" usebundle => wmde_install_packages(@(logrot.pkgs),"logrotate"); + freebsd:: + "any" usebundle => create_cron_job("logrotate","0 0 * * *","root $(logrot.cmd) $(logrot.conf)"); } diff --git a/templates/httpd-weblogrot-matomo.mustache b/templates/httpd-weblogrot-matomo.mustache new file mode 100644 index 0000000..ecad54d --- /dev/null +++ b/templates/httpd-weblogrot-matomo.mustache @@ -0,0 +1,18 @@ +{{vars.apache.log_dir}}/{{vars.apache_matomo.site.domain}}-access.log { + rotate 100 + size 1024k + + postrotate + service {{vars.apache.service_name}} restart ; {{{vars.apache_matomo.logger_script}}} + endscript +} + +{{vars.apache.log_dir}}/{{vars.apache_matomo.site.domain}}-error.log { + rotate 100 + size 100k + + postrotate + service {{vars.apache.service_name}} restart + endscript +} +