Uploads directory cleanup on root server

In the BigFix Lab site, the “Cache Management Dashboard” wizard shows which cached folders in the bfmirror/downloads/sha1 directory exists with no related fixlets.

Is there any way to get similar results but against the \wwwrootbes\Uploads\ directory on the root servers?

When we delete custom fixlets that download content from the Upload folder, the Upload folders remain after the fixlet is deleted and I’d like to keep them in sync.

1 Like

One option is just don’t upload content to their in the first place. You can put your custom content on a webserver that only the root server and consoles can access and then use that location in your prefetches. This will cause them to go into the web cache that gets cleaned up automatically and/or by that Dashboard.

This also has the advantage of allowing the same content to more easily be used by multiple root servers.

You can write a script that uses the REST API to get all prefetches and downloads in all content and then compares that against what exists in the files. If the file exists and the prefetch doesn’t, then archive or delete it.

1 Like

Ideally IBM or someone would provide an open source solution to do this easily.

There is already some session relevance on BigFix.Me that attempts to get all prefetch statements using session relevance that would be needed to do this.

Related:

Related: https://github.com/strawgate/C3-Platform-Kickstart/wiki/Cleanup-BigFix-Uploads-Directory

Thanks @strawgate !

1 Like

I was given the following session relevance below by L3, but the issue is that it is producing more directories than are actually in the uploads directory. It is reporting directories that are no longer there.

items 1 of it whose (item 0 of it = item 0 of item 1 of it) of
(
(elements of ((set of unique values of (tuple string item 0 of it as lowercase) of values of results of property 1 of bes fixlets whose (name of it is “BigFix Server - Uploads Directory - Windows”)) - (set of (it as lowercase) of unique values of parenthesized parts 2 of (matches (regex “(:|%22)([0-9a-fA-F]{40})( |%22)”) of it) of (scripts of actions of bes fixlets;action scripts of bes actions;scripts of actions of components of component groups of bes baselines;action scripts of member actions of bes actions;(values of shared variables of it; values of private variables of it) of bes wizards) ))), (tuple string item 0 of it as lowercase, tuple string item 1 of it | “NoFileFound”) of values of results of property 1 of bes fixlets whose (name of it is “BigFix Server - Uploads Directory - Windows”))

The answer is that the analysis has to be run to gather the current state of the uploads directory. See Strawgate’s post above.

This is what we use to manage Uploads folder structure. https://forum.bigfix.com/t/managing-the-uploadmanagerdata-folder/15888/28