From e032c62f20452d0b55810bc3bcce954b0b227c64 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Tue, 7 Aug 2018 10:30:52 -0400 Subject: [PATCH] Document puppet-cron cfg to cleanup old logs Issue: RELENG-1118 Change-Id: I580a22f62f6bd0d408f24f907a6e71afb6dad3e9 Signed-off-by: Thanh Ha --- docs/infra/nexus-puppet-cron.example | 18 ++++++++++++++++++ docs/infra/nexus.rst | 18 ++++++++++++++++++ docs/jenkins-sandbox.rst | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 docs/infra/nexus-puppet-cron.example diff --git a/docs/infra/nexus-puppet-cron.example b/docs/infra/nexus-puppet-cron.example new file mode 100644 index 0000000..1966919 --- /dev/null +++ b/docs/infra/nexus-puppet-cron.example @@ -0,0 +1,18 @@ +cron::daily: + purge-logs-production: + hour: 8 + user: 'nexus' + # yamllint disable-line rule:line-length + command: '/usr/bin/yes | /usr/bin/find /srv/sonatype-work/nexus/storage/logs/production -mtime +183 -delete 2>/dev/null' + purge-empty-dirs: + hour: 9 + user: 'nexus' + # yamllint disable-line rule:line-length + command: '/usr/bin/yes | /usr/bin/find /srv/sonatype-work/nexus/storage/logs -type d -empty -delete 2>/dev/null' +cron::weekly: + purge-logs-sandbox: + hour: 8 + weekday: 6 + user: 'nexus' + # yamllint disable-line rule:line-length + command: '/bin/rm -rf /srv/sonatype-work/nexus/storage/logs/sandbox/*' diff --git a/docs/infra/nexus.rst b/docs/infra/nexus.rst index 37b9d4d..d917caf 100644 --- a/docs/infra/nexus.rst +++ b/docs/infra/nexus.rst @@ -208,6 +208,24 @@ Configure global-var in ci-management Refer to :ref:`Jenkins CFG Global Variables ` for details on global-vars configuration. +Setup cron to cleanup old logs +------------------------------ + +We highly recommend setting up cron jobs to cleanup old logs periodically. + +1. Job to clean up files 6 months old on production path every day +2. Job to clean up empty directories in the logs path every day +3. Job to clean up all sandbox logs every week + +The following example shows the puppet-cron configuration used by LF to manage +logs following the Jenkins Sandbox rules defined in the +:ref:`Jenkins Sandbox Overview `. + +.. literalinclude:: nexus-puppet-cron.example + :language: yaml + :caption: puppet-cron example + + .. _create-repos-lftools: Create Nexus2 repos with lftools diff --git a/docs/jenkins-sandbox.rst b/docs/jenkins-sandbox.rst index 9d951ae..437bde4 100644 --- a/docs/jenkins-sandbox.rst +++ b/docs/jenkins-sandbox.rst @@ -3,6 +3,8 @@ Jenkins Sandbox =============== +.. _jenkins-sandbox-overview: + Sandbox Overview ---------------- -- 2.16.6