Automatically Clean Artifactory Artifacts

If you’re running into issues with artifacts taking up too much space on your Artifactory server, this will set you up with a programmatic way to clean old artifacts as they are no longer required.

Install ArtifactCleanup Plugin

SSH into the Artifactory server, go into the $JFROG_HOME/etc/plugins directory and run the following to download the Artifact Cleanup plugin:

Make changes to the artifactCleanup.json file based on desired behavior.

To enable logging, add the following to $ARTIFACTORY_HOME/etc/logback.xml:

Restart the server to install the plugin and get it set up for processing.

Invoking Manually

Read more information on executing cleanup manually on the GitHub page. It’s worth running as a dry-run and making sure functionality works as intended before letting loose.

After running, you can check the logs $ARTIFACTORY_HOME/logs/artifactory.log to find the results of cleanup.

Remember that once deleted using the plugin, the artifacts will remain in the Trash Can if it is enabled on your instance.