How to check my scripts usage with a SIL script on DC

How to check my scripts usage with a SIL script on DC

1. Problem description

In Jira Data Center instances that use SIL scripts extensively, it can be difficult to:

  • Determine which scripts under the silprograms (or sil.home) directory are actually linked to Jira configurations, and

  • Identify scripts that are stored on the filesystem but not used anywhere.

Manually inspecting the silprograms folder and cross‑checking each script against workflows, Live Fields, Listeners, or Schedulers is time‑consuming and error‑prone, especially in large environments.

Administrators often need a quick way to generate a reliable list of all scripts that are currently linked to configurations, regardless of whether those configurations have been executed recently.


2. Solution

You can use a SIL script in SIL Manager to automatically identify which SIL files are linked to configurations in your Jira Data Center instance.

This script:

  • Uses administrator credentials to call the REST endpoint /rest/keplerrominfo/refapp/latest/usage/FILE.

  • Scans all folders and files under your configured sil.home directory.

  • Logs each script that is associated with at least one configuration (workflows, Live Fields, Listeners, Schedulers, etc.).

  • Lets you exclude folders by adjusting the ignoredFolderPrefixes variable.

How it works

  • The script reads sil.home via silEnv("sil.home").

  • It recursively finds all directories and files, skipping any whose folder names start with prefixes defined in ignoredFolderPrefixes (for example ., _, !, examples).

  • For every script file found, it sends a request to the usage REST endpoint.

  • If the response indicates that the script is used (i.e. it is not marked as unused), the script logs the file path and its usage locations through runnerLog.

SIL script

string auth_user = "your_admin_user"; string auth_password = "admin_jira_password"; string REST = getJIRABaseUrl() + "/rest/keplerrominfo/refapp/latest/usage/FILE"; string rootFolder = silEnv("sil.home"); string[] ignoredFolderPrefixes = ".|_|!|examples"; string separator = "/"; // For Windows use "\\" struct Symbol { string name; string type; } struct Location { string integrationPointId; } struct Response { Symbol symbol; Location[] locations; boolean unused; } function callUsageREST(string filePath) { HttpRequest request; request.headers += httpCreateHeader("Content-Type", "application/json"); request.headers += httpBasicAuthHeader(auth_user, auth_password); string payloadData = "{ \"symbol\": \"" + filePath + "\"}"; payloadData = replace(payloadData, "\\", "/"); Response res = httpPost(REST, request, payloadData); number statusCode = httpGetStatusCode(); if (statusCode >= 200 && statusCode < 300) { if (!res.unused) { if (size(res.locations) > 0) { for (Location loc in res.locations) { runnerLog(res.symbol.name + " - Usage: " + loc.integrationPointId); } } else { runnerLog(res.symbol.name + " - Used, but no location returned"); } } } else { runnerLog("ERROR checking " + filePath + ": " + statusCode + " - " + httpGetErrorMessage() + " - " + httpGetReasonPhrase()); } } function searchScripts(string dir) { for (string file in findFiles(dir, ".*\\.sil")) { callUsageREST(file); } } function cleanUpList(string[] array) { array = arrayToSet(array); return arraySort(array, false); } function getAllDirs(string root) { string[] dirs = findDirectories(root, ".*"); string[] subDirs = dirs; int loopCount = 0; while (size(subDirs) > 0 && loopCount < 400) { string[] temp; for (string sd in subDirs) { boolean ignoredFolder = false; string[] dirNames = split(replace(sd, separator, "@"), "@"); for (string name in dirNames) { for (string pre in ignoredFolderPrefixes) { if (startsWith(name, pre)) { ignoredFolder = true; } } } if (!ignoredFolder) { temp += findDirectories(sd, ".*"); } } dirs += temp; subDirs = temp; loopCount++; } return cleanUpList(dirs); } runnerLog("Starting SIL usage scan from: " + rootFolder); searchScripts(rootFolder); for (string dir in getAllDirs(rootFolder)) { searchScripts(dir); } runnerLog("DONE!");

Example output

/var/atlassian/application-data/jira/silprograms/LiveFields/PanelPortal/main.sil - Usage: Live Fields Config [SELECT LIST] /var/atlassian/application-data/jira/silprograms/LiveFields/test/main.sil - Usage: Live Fields Config [test key custom field] /var/atlassian/application-data/jira/silprograms/test/Listener/test.sil - Usage: SIL Listener [Issue Updated] /var/atlassian/application-data/jira/silprograms/Validator/valInProgressKan.sil - Usage: Power Scripts SIL Validator, workflow: Software Simplified Workflow for Project KAN - Transition [In Progress] DONE!

3. Additional checks

After running the script and reviewing the output, consider the following checks and adjustments:

  1. Credentials and permissions

    • Ensure auth_user is a Jira administrator (or has sufficient permissions) to call the usage REST endpoint.

    • If the script does not return results or logs HTTP errors:

      • Verify auth_user / auth_password.

      • Confirm that the endpoint /rest/keplerrominfo/refapp/latest/usage/FILE is accessible in your environment.

      • Check for network or proxy restrictions between the Jira node and itself.

  2. Validate sil.home

    • Confirm that silEnv("sil.home") points to the correct directory where SIL scripts are stored.

    • In clustered Data Center environments, verify that the path is consistent across nodes.

  3. Tune ignored folders

    • Adjust ignoredFolderPrefixes to exclude:

      • System or hidden folders.

      • Sample or example scripts.

      • Temporary, backup, or archival directories.

    • This reduces noise in the log output and improves scan performance.

  4. Review critical configurations in the UI

    • For scripts that appear in the output and are critical to business processes:

      • Open the related workflows, Live Fields, Listeners, or Schedulers in Jira.

      • Confirm that the script paths shown in the UI match the paths logged by the SIL script.

      • Identify any deprecated or unexpected scripts that are still linked.

  5. Performance considerations

    • The script recursively scans all directories under sil.home. In environments with many scripts or deep directory trees, this may take some time.

    • Consider:

      • Running the script during lower‑usage periods.

      • Testing first in a staging environment with a copy of the scripts, if available.

      • Narrowing the scan scope (for example, temporarily changing rootFolder to a subdirectory) when investigating specific areas.