Logging Who Restarted Jenkins

326 views
Skip to first unread message

Greg Nifor

unread,
Mar 31, 2015, 1:37:26 PM3/31/15
to jenkins...@googlegroups.com
Is there a way to log who ordered a Jenkins restart? The log right now just denotes that a restart happened. I would like something like

Mar 30, 2015 9:57:01 PM INFO: Safe-restart started by GregWringle.


Is there anyway I can implement this?

Daniel Beck

unread,
Mar 31, 2015, 1:54:00 PM3/31/15
to jenkins...@googlegroups.com
Audit Trail Plugin records this if done via the /(safe)Restart URLs.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bcca4940-e2dd-4540-9700-ab2f437c3a84%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Daniel Beck

unread,
Mar 31, 2015, 2:06:15 PM3/31/15
to jenkins...@googlegroups.com
If Jenkins is ordered to shut down/restart, the user who ordered the restart should already get logged to jenkins.model.Jenkins:

https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/Jenkins.java#L3354
https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/Jenkins.java#L3393

Of course, if the user logs into the server and restarts the Jenkins service, it won't get logged this way. There's no way for Jenkins to determine who does it either.

On 31.03.2015, at 19:37, Greg Nifor <whiteho...@gmail.com> wrote:

Maureen Barger

unread,
Mar 31, 2015, 2:22:04 PM3/31/15
to jenkins...@googlegroups.com

On Tue, Mar 31, 2015 at 2:06 PM, Daniel Beck <m...@beckweb.net> wrote:
Of course, if the user logs into the server and restarts the Jenkins service, it won't get logged this way. There's no way for Jenkins to determine who does it either.

You can add it to the script itself if you do it from command line and output to another file on the OS. You have the account used as a login, the script run which probably reflects the action (start|stop|restart) and the time etc.
Reply all
Reply to author
Forward
0 new messages