Skip to end of metadata
Go to start of metadata

Steps to enable an access log

For Ubuntu:

  1. Add these lines to /etc/default/jenkins above JENKINS_ARGS:
    # Enable access log
    JENKINS_ACCESSLOG="--accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/log/jenkins/access.log"
    
  2. Edit /etc/default/jenkins and add  $JENKINS_ACCESSLOG to JENKINS_ARGS
  3. Enable log rotation: edit /etc/logrotate.d/jenkins and change /var/log/jenkins/jenkins.log to /var/log/jenkins/*.log

For Windows service:

  1. Add the line to %JENKINS_HOME%/jenkins.xml in <arguments> block.
     --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file="%BASE%/logs/access.log"
    
  2. Restart Jenkins service after edit.
    Updated jenkins.xml
    <service>
      <id>jenkins</id>
      <name>Jenkins</name>
      <description>This service runs Jenkins continuous integration system.</description>
      <env name="JENKINS_HOME" value="%BASE%"/>
      <!--
        if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
        The following value assumes that you have java in your PATH.
      -->
      <executable>%JAVA_HOME%\bin\java</executable>
    
      <arguments>-Xrs -Xmx3072m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war" --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file="%BASE%/logs/access.log"</arguments>
    
      <!--
        interactive flag causes the empty black Java window to be displayed.
        I'm still debugging this.
      <interactive />
      -->
      <logmode>rotate</logmode>
    
      <onfailure action="restart" />
    </service>
    
  3. Access logs will be created in "%BASE%/logs/access.log" but (warning) log will be lost on service restart.
  • No labels

3 Comments

  1. I believe this is when you install by default in jetty server. I am running my jenkins within the Tomcat web server and  I want user access logs, any suggestions? Thanks in advance

    1. This is tomcat specific. You'd need to configure an Access Log Valve if I understand correctly.

  2. Does this provide User creation log data as well? For ex: I want to know who created a particular user