Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53430

Capture logged in username and IP Address Audit Trail Plugin

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • audit-trail-plugin
    • None

      Enhance the audit trail plugin to capture the logged in username and Client IP address for all the action that is configured in audit trail parser.

      New feature would support capturing the username and client IP address for the "login action" , all the build, configuration related action each requests appended with logged in user and "clientIP address" including the user actions.

          [JENKINS-53430] Capture logged in username and IP Address Audit Trail Plugin

          Pierre Beitz added a comment -

          Closing for inactivity, please reopen in case you still have this need and have details on the feature.

          Pierre Beitz added a comment - Closing for inactivity, please reopen in case you still have this need and have details on the feature.

          I just installed Audit Trail plugin on a Jenkins instance running in "everyone can do anything" mode. This works just fine for us, but sometimes it is nice to know who did what, so we don't have to shout in the chat groups: "Hey, who just started this job, it has failed, please have a look!"

          So I installed this plugin, expecting it to log user's IP addresses, since in JENKINS-10559 it is written that it should. However, in reality the plugin thinks that anonymous is a good username and there is no need to retrieve the IP address. So in the logs I see the following:

          Aug 24, 2023 3:27:03,083 PMSandbox » auto-tests #171 Started by user anonymous, Parameters:[] on node #unknown# started at 2023-08-24T15:00:38Z completed in 1584852ms completed: FAILURE
          

          As you can see, no IP address is logged. So I'll take the liberty to go ahead and reopen this ticket.

          Vlad Nikiforov added a comment - I just installed Audit Trail plugin on a Jenkins instance running in "everyone can do anything" mode. This works just fine for us, but sometimes it is nice to know who did what, so we don't have to shout in the chat groups: "Hey, who just started this job, it has failed, please have a look!" So I installed this plugin, expecting it to log user's IP addresses, since in JENKINS-10559 it is written that it should. However, in reality the plugin thinks that anonymous is a good username and there is no need to retrieve the IP address. So in the logs I see the following: Aug 24, 2023 3:27:03,083 PMSandbox » auto-tests #171 Started by user anonymous, Parameters:[] on node #unknown# started at 2023-08-24T15:00:38Z completed in 1584852ms completed: FAILURE As you can see, no IP address is logged. So I'll take the liberty to go ahead and reopen this ticket.

          Chase added a comment -

          myx_ostankin did you ever find a solution? I am experiencing the same issue - there is no ip address in the logs.  

          Chase added a comment - myx_ostankin did you ever find a solution? I am experiencing the same issue - there is no ip address in the logs.  

          Chase added a comment -

          After enabling the setting Display Username instead of UserID the IP address appeared in the logs

          Chase added a comment - After enabling the setting Display Username instead of UserID the IP address appeared in the logs

          sirkingchase , strangely your suggestion doesn't work for me. I ticked the checkbox in the settings you mentioned, but I still see "user anonymous" instead of their IP address. In fact, I didn't notice any changes at all.

          My Jenkins version is 2.442, Audit Trail plugin version is 361.v82cde86c784e.

          Vlad Nikiforov added a comment - sirkingchase , strangely your suggestion doesn't work for me. I ticked the checkbox in the settings you mentioned, but I still see "user anonymous" instead of their IP address. In fact, I didn't notice any changes at all. My Jenkins version is 2.442, Audit Trail plugin version is 361.v82cde86c784e.

          Chase added a comment -

          Hey Vlad, do you allow anonymous (not logged in) users to trigger builds? (Or whatever event you’re trying to log).  

          FYI my pipelines require the user to be logged in order to manually trigger the build (else it’s read only) and it’s working with that setting. I do have some scheduled build jobs and those logs are similar to what you have described (ex: non user triggered builds have no ip info)

          Chase added a comment - Hey Vlad, do you allow anonymous (not logged in) users to trigger builds? (Or whatever event you’re trying to log).   FYI my pipelines require the user to be logged in order to manually trigger the build (else it’s read only) and it’s working with that setting. I do have some scheduled build jobs and those logs are similar to what you have described (ex: non user triggered builds have no ip info)

          sirkingchase , yes, that's exactly the reason: we don't require users to log in. So this looks like a joke: for authenticated users, who are already identified through authentication, the IP address is logged, but for anonymous users it is not

          Vlad Nikiforov added a comment - sirkingchase , yes, that's exactly the reason: we don't require users to log in. So this looks like a joke: for authenticated users, who are already identified through authentication, the IP address is logged, but for anonymous users it is not

          Pierre Beitz added a comment -

          > for authenticated users, who are already identified through authentication, the IP address is logged, but for anonymous users it is not

           

          Smells like a bug but I'm not exactly sure how you get to this situation. Would you mind making a detailed bug report?

          Pierre Beitz added a comment - > for authenticated users, who are already identified through authentication, the IP address is logged, but for anonymous users it is not   Smells like a bug but I'm not exactly sure how you get to this situation. Would you mind making a detailed bug report?

          pierrebtz , sure, created one!

          JENKINS-72728

          Vlad Nikiforov added a comment - pierrebtz , sure, created one! JENKINS-72728

          Pierre Beitz added a comment -

          Taking the conversation on the new task, closing this one.

          Pierre Beitz added a comment - Taking the conversation on the new task, closing this one.

            pierrebtz Pierre Beitz
            towens Trey Owens
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: