You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取Jenkins特定插件的安装用户及已装插件的安装用户列表?

Hey there! Let's break down how to track which users installed Jenkins plugins—both getting a full list with installers, and looking up info for a specific plugin.

First, a quick heads-up: Jenkins doesn't natively store plugin installation user details in a persistent database by default. Most of this info lives in system logs, unless you set up an audit plugin to track it long-term. Let's cover both scenarios.

1. Get a list of all installed plugins + their installing users

Option 1: Check Jenkins System Logs (no extra plugins needed)

This is the quickest way if your logs haven't been rotated or cleaned up yet:

  • Log into Jenkins, go to Manage Jenkins → System Log
  • Use the search bar to look for the phrase installed plugin
  • You'll see log entries that look like this:

    2024-05-20 14:32:15.123+0000 [id=123] INFO hudson.PluginManager#install: User admin installed plugin 'git' version '5.2.0'
    Each entry tells you the username, plugin name, and version. You can manually compile these into a list, or export the log and parse it with a script if you have a lot of plugins.

Option 2: Use the Audit Trail Plugin for long-term tracking

If you need to keep this info permanently (and avoid losing it when logs rotate), install the Audit Trail plugin:

  • Go to Manage Jenkins → Plugins → Available Plugins, search for "Audit Trail" and install it
  • After installation, head to Manage Jenkins → Configure System and find the Audit Trail section
  • Set a log file path (e.g., /var/log/jenkins/audit.log) and customize the log format to include the username (%u) and action details (%m)
  • Save the config—from now on, every plugin install (and other admin actions) will be logged to this file. You can later parse it to get a full list of plugins and their installers.

2. Look up the user who installed a specific plugin

  • Using default system logs: In the System Log search bar, combine the plugin name with installed plugin (e.g., installed plugin sonar) to filter directly to that plugin's install record.
  • Using Audit Trail log file: If you're using the Audit Trail plugin, ssh into your Jenkins server and run a grep command like this (replace the path and plugin name with your own):
    grep "installed plugin sonar" /var/log/jenkins/audit.log
    
    This will spit out all entries related to that plugin's installation, including the user who did it.

Option 2: Groovy Script via Jenkins Script Console (Audit Trail required)

If you want a more programmatic way, use the Jenkins Script Console with the Audit Trail plugin installed:

  • Go to Manage Jenkins → Script Console
  • Paste this Groovy script, replacing PLUGIN_NAME with the exact name of the plugin you're checking:
    import jenkins.model.Jenkins
    import org.jenkinsci.plugins.audit_trail.AuditTrailPlugin
    
    def targetPlugin = "PLUGIN_NAME"
    def auditRecords = AuditTrailPlugin.instance.getLogRecords()
    
    auditRecords.each { record ->
        if (record.getMessage().contains("installed plugin ${targetPlugin}")) {
            println "User: ${record.userName}, Timestamp: ${new Date(record.timestamp)}, Details: ${record.message}"
        }
    }
    
  • Click "Run"—the output will show you the user, timestamp, and full message for the plugin's installation.

A quick note: If plugins were installed via automated tools (like jenkins-plugin-cli or CI/CD scripts), the log might show anonymous or the system user running the script instead of a human user.

内容的提问来源于stack exchange,提问作者DeepoOoOoz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:03:43