Document puppet-cron cfg to cleanup old logs 41/12141/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 7 Aug 2018 14:30:52 +0000 (10:30 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 7 Aug 2018 14:44:43 +0000 (10:44 -0400)
Issue: RELENG-1118
Change-Id: I580a22f62f6bd0d408f24f907a6e71afb6dad3e9
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
docs/infra/nexus-puppet-cron.example [new file with mode: 0644]
docs/infra/nexus.rst
docs/jenkins-sandbox.rst

diff --git a/docs/infra/nexus-puppet-cron.example b/docs/infra/nexus-puppet-cron.example
new file mode 100644 (file)
index 0000000..1966919
--- /dev/null
@@ -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/*'
index 37b9d4d..d917caf 100644 (file)
@@ -208,6 +208,24 @@ Configure global-var in ci-management
 Refer to :ref:`Jenkins CFG Global Variables <global-jjb:jenkins-cfg-envvar>`
 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 <jenkins-sandbox-overview>`.
+
+.. literalinclude:: nexus-puppet-cron.example
+   :language: yaml
+   :caption: puppet-cron example
+
+
 .. _create-repos-lftools:
 
 Create Nexus2 repos with lftools
index 9d951ae..437bde4 100644 (file)
@@ -3,6 +3,8 @@
 Jenkins Sandbox
 ===============
 
+.. _jenkins-sandbox-overview:
+
 Sandbox Overview
 ----------------