ArielGlenn has submitted this change and it was merged.

Change subject: jenkins: logrotate access.log
......................................................................


jenkins: logrotate access.log

Jenkins does not automatically logrotate its access log. One has to rely
on logrotate to do so.  The Debian package provided by upstream does not
include the script so I just copy pasted it and amended the filename to
match our own configuration.

A bug got filled upstream to have the logrotate script included in
Debian package:
https://issues.jenkins-ci.org/browse/JENKINS-18870

daily explicitly set
rotate and maxage set to 30

Change-Id: Iee3495be6ebf812478da83470053512d1fc0587a
---
A modules/jenkins/files/jenkins_accesslog.logrotate
M modules/jenkins/manifests/init.pp
2 files changed, 29 insertions(+), 0 deletions(-)

Approvals:
  ArielGlenn: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/jenkins/files/jenkins_accesslog.logrotate 
b/modules/jenkins/files/jenkins_accesslog.logrotate
new file mode 100644
index 0000000..2d4ef03
--- /dev/null
+++ b/modules/jenkins/files/jenkins_accesslog.logrotate
@@ -0,0 +1,20 @@
+# Logrotate file copied from upstream since it is not shipped
+# by upstream Debian package.
+# https://issues.jenkins-ci.org/browse/JENKINS-18870
+/var/log/jenkins/access.log {
+    compress
+    dateext
+       daily
+    maxage 30
+       rotate 30
+    size=+4096k
+    notifempty
+    missingok
+    create 644
+    postrotate
+      if [ -s /var/run/jenkins.pid ]; then
+        JPID=`cat /var/run/jenkins.pid`
+        test -n "`find /proc/$JPID -maxdepth 0 -user jenkins 2>/dev/null`" && 
/bin/kill -s ALRM $JPID || :
+      fi
+    endscript
+}
diff --git a/modules/jenkins/manifests/init.pp 
b/modules/jenkins/manifests/init.pp
index b1a851a..8d69ce3 100644
--- a/modules/jenkins/manifests/init.pp
+++ b/modules/jenkins/manifests/init.pp
@@ -50,6 +50,15 @@
     owner  => 'jenkins',
     group  => 'jenkins',
   }
+  # access.log rotation. Not provided by upstream Debian package
+  # https://issues.jenkins-ci.org/browse/JENKINS-18870
+  file { '/etc/logrotate.d/jenkins_accesslog':
+    owner  => 'root',
+    group  => 'root',
+    mode   => '0444',
+    source => 'puppet:///modules/jenkins/jenkins_accesslog.logrotate',
+  }
+
   file { '/etc/default/jenkins':
     owner  => 'root',
     group  => 'root',

-- 
To view, visit https://gerrit.wikimedia.org/r/75113
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iee3495be6ebf812478da83470053512d1fc0587a
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to