From fd8f71dd16a0c9d546e63aeec5238c29f4214e09 Mon Sep 17 00:00:00 2001 From: Pierre Guilleminot Date: Fri, 22 Dec 2023 16:54:08 +0100 Subject: [PATCH] Add a logrotate for datadog logs --- modules/user_data/templates/install.sh.tftpl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/user_data/templates/install.sh.tftpl b/modules/user_data/templates/install.sh.tftpl index 1d617055..97afa670 100644 --- a/modules/user_data/templates/install.sh.tftpl +++ b/modules/user_data/templates/install.sh.tftpl @@ -35,6 +35,17 @@ Unattended-Upgrade::Automatic-Reboot-WithUsers "true"; Unattended-Upgrade::Automatic-Reboot-Time "now"; EOF +cp /etc/cron.daily/logrotate /etc/cron.hourly/logrotate +cat < /etc/logrotate.d/datadog +/var/log/datadog/*.log { + hourly + rotate 12 + compress + missingok + notifempty +} +EOF + %{ if site == "datad0g.com" } cat <> /etc/datadog-agent/datadog.yaml remote_configuration: