• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • audit-trail-plugin
    • None
    • Jenkins version: 2.442
      Audit Trail plugin version: 361.v82cde86c784e

      We allow anonymous users in our Jenkins instance. The problem is, however, is that we would like to see the IP address of the one who triggered a job. Ironically, the IP address is only logged for authenticated users (where it is in fact unnecessary, since the user has already been identified), while for anonymous users it is not. Here's what I see when an unauthenticated user starts a job:

      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 

      The issue was also discussed in JENKINS-53430, but I was asked to create a dedicated bug ticket.

          [JENKINS-72728] IP address of anonymous users is not logged

          Pierre Beitz added a comment -

          myx_ostankin I had a look to your use case and I'm pretty sure there is nothing more that we can do.

          What you are looking at (Started by user...) is managed by a RunListener. The RunListener doesn't have access to the IP of the user who triggered the build.

          This leads me to a question about your statement:

           

           > the IP address is only logged for authenticated users

           

          AFAICT, this is not possible, at least if you use the RunListener, as explained above. There is no way to retrieve the IP this way.

           

          That being said, you can achieve what you wish by adjusting the `URL Patterns to Log` and adding `build` (and/or `buildWithParameters` if you use parametrised builds).

          This way you are logging at the request level and you'll get the IP dumped, eg:

           

          /job/pipeline4/build by NA from 127.0.0.1 

           

          Hope that helps.

          Pierre Beitz added a comment - myx_ostankin I had a look to your use case and I'm pretty sure there is nothing more that we can do. What you are looking at (Started by user...) is managed by a RunListener. The RunListener doesn't have access to the IP of the user who triggered the build. This leads me to a question about your statement:    > the IP address is only logged for authenticated users   AFAICT, this is not possible, at least if you use the RunListener, as explained above. There is no way to retrieve the IP this way.   That being said, you can achieve what you wish by adjusting the `URL Patterns to Log` and adding `build` (and/or `buildWithParameters` if you use parametrised builds). This way you are logging at the request level and you'll get the IP dumped, eg:   /job/pipeline4/build by NA from 127.0.0.1   Hope that helps.

          pierrebtz , thank you for looking into this, and for the workaround you suggested! I tested it – at least at the first glance looks working!

          What do we do with the ticket now – do we close it or let it stay the way it is, hoping that the possibility to do it properly shows up one day?

           

          Vlad Nikiforov added a comment - pierrebtz , thank you for looking into this, and for the workaround you suggested! I tested it – at least at the first glance looks working! What do we do with the ticket now – do we close it or let it stay the way it is, hoping that the possibility to do it properly shows up one day?  

          Pierre Beitz added a comment -

          As you wish, I have no preference.

          Pierre Beitz added a comment - As you wish, I have no preference.

            pierrebtz Pierre Beitz
            myx_ostankin Vlad Nikiforov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: