docker icon indicating copy to clipboard operation
docker copied to clipboard

NOT able to enable Jenkins access logs

Open nikhilbhambure opened this issue 5 years ago • 5 comments

NOT able to set/enable Jenkins access logs inside the container

I am trying to enable Jenkins Access Logs inside the container. I followed the general link which describes access logging https://wiki.jenkins.io/display/JENKINS/Access+Logging. Tried to put JENKINS_ACCESSLOG under ENV in our automation scripts but it did not work

After digging for a sometime, found out that jenkins.sh (which resides in /usr/local/bin/ i.e. path inside container) is the main script which reads the arguments and executes. I tried to set/enable the access log in this shell script and it worked. But this is very tedious way to achieve objective

Jenkins version: 2.164.2 Docker version: 18.09.2

  • Is it possible to set/enable Jenkins user access logs from Jenkins home directory inside docker container?(/var/jenkins_home is the Jenkins home inside container). If yes, May I know how to set/enable access logs in this case
  • Also access logs does not contain user names. Is it possible to print the same in access logs Can anybody help on this front?

Thanks, Nikhil

nikhilbhambure avatar Jul 30 '19 13:07 nikhilbhambure

can anybody update on this issue please

nikhilbhambure avatar Aug 05 '19 08:08 nikhilbhambure

Ok. solved!! We can use JENKINS_OPTS under ENV section (in ansible role). I was using JENKINS_ARGS instead of JENKINS_OPTS

now new line which solved the problem is : -

JENKINS_OPTS: "--accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/jenkins_home/logs/access_log"

Is it possible to log the username in Jenkins AccessLogs ?

nikhilbhambure avatar Aug 06 '19 13:08 nikhilbhambure

Hello. i use:

/usr/bin/docker run --name jenkins-master
--group-add=233
--publish=8081:8080
--publish=50000:50000
--env JAVA_OPTS=-Xmx2g
--env JENKINS_ARGS="--httpKeepAliveTimeout=30000 --httpsKeepAliveTimeout=30000 --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=comb ined --simpleAccessLogger.file=/var/jenkins_home/logs/access_log"
--user root
jenkins/jenkins

but access log not write. Help me pls.

ExBleaK avatar Aug 21 '19 08:08 ExBleaK

Can you try with JENKINS_OPTS (as an environment parameter)instead of JENKINS_ARGS

nikhilbhambure avatar Aug 21 '19 12:08 nikhilbhambure

https://github.com/jenkinsci/docker/pull/1292 Could you check it this pr fixes your issue? :)

DuMaM avatar Feb 23 '22 00:02 DuMaM

Hi, Iwould like to work

Nandini99-git avatar Oct 25 '22 08:10 Nandini99-git