Create a logger to log login attempts

Article ID:360055861391
1 minute readKnowledge base

Issue

  • You need to see how many failed attempts there are for your Jenkins instance.

  • You need to see IP addresses where failed logins are occurring.

Resolution

  1. Install the Audit Trail Plugin on your Jenkins Instance.

  2. Navigate to the Audit Trail configuration.

    • Manage Jenkins > Configure Jenkins > Audit Trail

  3. Configure the following settings in the Audit Trail configuration:

    1. Click "Add Logger" and select Console.

    2. Output should be set to STD_ERR.

    3. Click ""Advanced…​"" for the Audit Trail configuration. In the URL Patterns to Log section add loginError at the end of the URL Patterns, just before the parenthesis.

      • The URL Patterns in this box can be customized to your liking if you would not like to log all of these patterns.

    url-patterns-to-log.png
    1. Save your changes.

  4. Navigate to your Log Recorders.

    • Manage Jenkins > System Logs

  5. Create a New Log Recorder.

    • The name can be set to your liking.

  6. Add the following loggers to your newly created log recorder:

    • jenkins.security.SecurityListener - set the logger to the FINE level.

    • hudson.plugins.audit_trail.AuditTrailFilter - set the logger to the FINE level.

  7. Save your changes.

  8. When there is a failed login attempt you will now see them report in your new logger with the client’s IP Address. login-attempt.png

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.