ARTIFACTORY: Automating and Manual License Key Cleanup in Access Config
Introduction
When scaling new clusters via auto-scaling in AWS, it’s important to remove old licenses from the access.config YAML file.
Regularly cleaning up the license section of decommissioned nodes helps prevent the error "The incoming YAML document exceeds the limit: 3145728 code points" by avoiding excessively large YAML documents.
The process of license key cleanup has been automated in Artifactory versions 7.68 and above.
This guide provides instructions for both automated cleanup in versions 7.68 and above and manual cleanup for any 7.x versions.
Resolution
Automated Cleanup for Artifactory 7.68 and Above1. Enable License Key Cleanup Automation:
- Copy access.config.latest.yml to access.config.import.yml
- Configure the clean-unused-licenses task in the access.config.import.yml file to automate the removal of old license keys
- Ensure that the interval-seconds value is set to at least 600 seconds (10 minutes) or above; a value of 0 disables the task
Note: Between versions 7.68 and 7.85, the default value for interval-seconds was 0 (task disabled).
From version 7.85.1 onward, the default is set to 86,400 seconds (1 day).
task:
clean-unused-licenses:
interval-seconds: 600 # seconds to run job to clean licenses2. Adjust Stale License Consideration Time:Modify the stale-admin-revoke configuration to change how quickly a server is considered stale:
task:
stale-admin-revoke:
consider-stale-seconds: 500 # seconds to consider stale (default is 6048003. Understand the Removal Process:The system will mark a license for removal on the first iteration and remove it on the second to avoid removing licenses from nodes that are restarting or upgrading4. Restart Artifactory: systemctl restart artifactor
5. Verify Automated Cleanup: You can verify the task is working by monitoring the access-service.log. After the configured interval (e.g., 600 seconds) expires, you will see log entries similar to the following, indicating which server licenses are being targeted for removal:2025-11-17T19:37:01.235Z [jfac ] [INFO ] [bc041b2a6449fee0] [edUnusedLicensesCleanupJob:199] [task-pool-5-thread-3] - About to remove licenses from access config for servers - [unused-artifactory2, unused-artifactory3] 2025-11-17T19:37:01.268Z [jfac ] [INFO ] [bc041b2a6449fee0] [edUnusedLicensesCleanupJob:164] [task-pool-5-thread-3] - About to remove licenses from platform config for servers - [unused-artifactory2, unused-artifactory3]
After the task runs, the unused licenses will be removed automatically from the access.config.latest.yml file and, subsequently, from the access_config and access_platform_config tables in the database.
You can check the licenses currently stored in the access database by running the following SQL query in the Artifactory database:
SELECT * FROM access_platform_config WHERE config_key LIKE '%.license.key';
Similarly, you can check the access.config.latest.yml file to check the licenses that are getting served to the access microservice.
Manual Cleanup for any Artifactory Versions1. Create a backup of the configuration File:
- Start by creating a backup of the access.config.latest.yml file.
- Save the duplicate as access.config.import.yml:
cp access.config.latest.yml access.config.import.yml
2. Edit the Duplicated File:- Open access.config.import.yml in your text editor.
- Delete the entire licenses: section, which includes all nodes (valid and decommissioned).
For example, use the following command to delete the licenses: section:
sed '/licenses:/,/^$/ {/schema-version: 2/!d}' access.config.latest.yml > access.config.import.yml3. Restart Artifactory: systemctl restart artifactory4. After restarting,: verify that only valid node information remains under the licenses: section in access.config.latest.yml.
ConclusionFor Artifactory 7.68 and above, configuring automated cleanup ensures a streamlined process for managing outdated license keys. For versions below 7.68, follow the manual cleanup procedure to maintain an updated configuration. Regular maintenance helps avoid errors and ensures optimal operation of your Artifactory instance.