From a435e88b2529ecf3dabd7b8dc1d3f33e22f489d3 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 18 Mar 2019 22:05:35 -0700 Subject: [PATCH] rotate task logs --- CHANGES | 2 ++ setup/start.sh | 5 ++--- setup/start/logrotate/app | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 1aee52700..0a1b88092 100644 --- a/CHANGES +++ b/CHANGES @@ -1568,4 +1568,6 @@ * Fix issue where DKIM was not setup correctly during a restore * (mysql) Remove any stale lock file on restart * Add a way to disable outbound mail for a domain +* Cleanup task logs +* Fix issue where dashboard location might conflict with existing app location diff --git a/setup/start.sh b/setup/start.sh index 851a54355..ac2999fa5 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -126,6 +126,8 @@ if ! grep -q "^include ${PLATFORM_DATA_DIR}/logrotate.d" /etc/logrotate.conf; th fi cp "${script_dir}/start/logrotate/"* "${PLATFORM_DATA_DIR}/logrotate.d/" rm -f "${PLATFORM_DATA_DIR}/logrotate.d/box-logrotate" "${PLATFORM_DATA_DIR}/logrotate.d/app-logrotate" # remove pre 3.6 config files + +# logrotate files have to be owned by root, this is here to fixup existing installations where we were resetting the owner to yellowtent chown root:root "${PLATFORM_DATA_DIR}/logrotate.d/" echo "==> Adding motd message for admins" @@ -187,9 +189,6 @@ chown "${USER}:${USER}" "${PLATFORM_DATA_DIR}/INFRA_VERSION" 2>/dev/null || true chown "${USER}:${USER}" "${PLATFORM_DATA_DIR}" chown "${USER}:${USER}" "${APPS_DATA_DIR}" -# logrotate files have to be owned by root, this is here to fixup existing installations where we were resetting the owner to yellowtent -chown root:root -R "${PLATFORM_DATA_DIR}/logrotate.d" - # do not chown the boxdata/mail directory; dovecot gets upset chown "${USER}:${USER}" "${BOX_DATA_DIR}" find "${BOX_DATA_DIR}" -mindepth 1 -maxdepth 1 -not -path "${BOX_DATA_DIR}/mail" -exec chown -R "${USER}:${USER}" {} \; diff --git a/setup/start/logrotate/app b/setup/start/logrotate/app index f83e7f5eb..acc28eeb4 100644 --- a/setup/start/logrotate/app +++ b/setup/start/logrotate/app @@ -1,6 +1,7 @@ -# logrotate config for app and crash logs +# logrotate config for app, crash, addon and task logs -/home/yellowtent/platformdata/logs/*/*.log { +# man 7 glob +/home/yellowtent/platformdata/logs/[!t][!a][!s][!k][!s]/*.log { # only keep one rotated file, we currently do not send that over the api rotate 1 size 10M @@ -8,3 +9,10 @@ nocompress copytruncate } + +/home/yellowtent/platformdata/logs/tasks/*.log { + monthly + rotate 0 + missingok +} +