How do I monitor log of the users who successfully logged into my Jenkins Server?

17,387

Solution 1

  1. Go to -> Manage Jenkins -> System Log
  2. Click on add new log recorder and name it anything you like for example -> user_access_details
  3. Then click on add loggers once prompted and add jenkins.security.SecurityListener and set it to Finest level

Should look like this -

Should look like this

Logs would look like this -

Logs would look like this

Solution 2

You can enable access log by adding 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"

Enable log rotation: edit /etc/logrotate.d/jenkins and change /var/log/jenkins/jenkins.log to /var/log/jenkins/*.log

Copy from here.

Does it help?

Solution 3

If you want to see who is doing what, I would install the Audit Trail Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Audit+Trail+Plugin and if you're really hardcore, I would install the Audit to Database Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Audit+To+Database+Plugin

Solution 4

Using Audit trail you can achieve this by adding the following parameter (login|logout|loginError). One issue with this approach is it will give the logout and loginError properly but login info is not satisfactory .

Share:
17,387
Triangle
Author by

Triangle

if [ You came till here ]; then juanting.wordpress.com to know more about me fi

Updated on June 16, 2022

Comments

  • Triangle
    Triangle almost 2 years

    I want to Monitor name/E-mail/IP id of User's who Successfully logged in to my Jenkins's server. I am the system Administrator. Please help.

  • Triangle
    Triangle over 8 years
    thanks Bruno. I used the above method but it gives access logs ,that is it gives me from where my server has been tried to open. It does not tell me whether user tried to login or not. I want to get those logs in which a user successfully logins to the server (after entering username password).In the above method user need not to login then also log will come.
  • Bruno Lavit
    Bruno Lavit over 8 years
    I did a try with several options and I'm not able to find any login information in the logs :(
  • Triangle
    Triangle over 8 years
    You can configure the details of log under System log in manage Jenkins option.There you can create your own custom log. I am using active directory plugin so for me the custom comes from "hudson.plugins.active_directory.ActiveDirectorySecurityReal‌​m" Here I can find the name of user/Email-id of the user who logs in. But I want these details on my host (linux) machine where the server is hosted.This log comes only in GUI and no file is created in the back end.For details refer:- stackoverflow.com/questions/32563942/…
  • Bruno Lavit
    Bruno Lavit over 8 years
    Thanks for the update, I hope you will find a solution :)
  • Riccardo79
    Riccardo79 almost 4 years
    Thanks, is it possibile to save this log to file?
  • Riccardo79
    Riccardo79 almost 4 years
    Hello, nice tips. About login user, did you find anything more usable?