-
Bug
-
Resolution: Fixed
-
Major
-
Jenkins 1.611 running on RHEL 6.6 using audit-trail plugin 2.1
There is a log rotation issue with the Log File logger in the audit-trail plugin.
I set the count parameter to 1 and the limit to 512. Yet the log file is still being rotated every time more than two lines are written:
[jenkins ~]$ cat /data/jenkins/audit-trail.xml <?xml version='1.0' encoding='UTF-8'?> <hudson.plugins.audit__trail.AuditTrailPlugin plugin="audit-trail@2.1"> <pattern>.*/(?:configSubmit|doDelete|postBuildResult|cancelQueue|stop|toggleLogKeep|doWipeOutWorkspace|createItem|createView|toggleOffline)</pattern> <logBuildCause>true</logBuildCause> <loggers> <hudson.plugins.audit__trail.LogFileAuditLogger> <log>/data/jenkins/logs/audit-trail.log</log> <limit>512</limit> <count>1</count> </hudson.plugins.audit__trail.LogFileAuditLogger> </loggers> </hudson.plugins.audit__trail.AuditTrailPlugin> [jenkins ~]$ ls -altr /data/jenkins/logs/audit-trail.log* -rw-r--r--. 1 jenkins jenkins 0 May 7 11:05 /data/jenkins/logs/audit-trail.log.lck -rw-r--r--. 1 jenkins jenkins 97 May 7 11:06 /data/jenkins/logs/audit-trail.log -rw-r--r--. 1 jenkins jenkins 0 May 7 11:06 /data/jenkins/logs/audit-trail.log.1.lck -rw-r--r--. 1 jenkins jenkins 97 May 7 11:06 /data/jenkins/logs/audit-trail.log.1 -rw-r--r--. 1 jenkins jenkins 0 May 7 11:06 /data/jenkins/logs/audit-trail.log.2.lck -rw-r--r--. 1 jenkins jenkins 97 May 7 11:06 /data/jenkins/logs/audit-trail.log.2 -rw-r--r--. 1 jenkins jenkins 0 May 7 11:07 /data/jenkins/logs/audit-trail.log.3.lck -rw-r--r--. 1 jenkins jenkins 97 May 7 11:14 /data/jenkins/logs/audit-trail.log.3 -rw-r--r--. 1 jenkins jenkins 0 May 7 11:14 /data/jenkins/logs/audit-trail.log.4.lck -rw-r--r--. 1 jenkins jenkins 115 May 7 11:15 /data/jenkins/logs/audit-trail.log.4 -rw-r--r--. 1 jenkins jenkins 0 May 7 11:15 /data/jenkins/logs/audit-trail.log.5.lck -rw-r--r--. 1 jenkins jenkins 115 May 7 11:15 /data/jenkins/logs/audit-trail.log.5 -rw-r--r--. 1 jenkins jenkins 0 May 7 11:15 /data/jenkins/logs/audit-trail.log.6.lck -rw-r--r--. 1 jenkins jenkins 0 May 7 11:15 /data/jenkins/logs/audit-trail.log.6
It appears the log rotation count is not working correctly.
- duplicates
-
JENKINS-44129 Log file logger for Audit trail plugin leaks open file descriptors
-
- Resolved
-
I see there are multiple .lck files that are opened and do not go away. From reading up on FileHandler, that typically indicates multiple instances of FileHandler being instantiated. They say that is typically caused by multiple JVMs writing to the same log file. However, I am only using one JVM (verified with ps).
I'm wondering if the issue is in hudson.plugins.audit_trail.LogFileAuditLogger line 21:
I'm thinkning maybe the extension creates several instances of the audit-trail logger, and therefore multiple FileHandler instances trying to write to the same log file.
Is there a reason this attribute is marked as transient? I didn't think this was a serializable object. Perhaps the solution would be to mark it as static so that multiple instances do not exist in the same container.