We created a script for customers to clean up log-bundles and submitted a feature request to make log-bundle retention configurable.
Here is the relevant code,
fetch_logs.rb,
where the retention period is set.
In order to run the script, you must be logged into the BOSH Director VM as the '
vcap' user.
Script
while read -r id
do
/var/vcap/packages/postgres-10/bin/psql -th 127.0.0.1 -p 5432 bosh -c "delete from log_bundles where blobstore_id = '"$id"';"
if [ -f /var/vcap/store/blobstore/store/??/"$id" ]
then
rm /var/vcap/store/blobstore/store/??/"$id"
fi
done < <(/var/vcap/packages/postgres-10/bin/psql -th 127.0.0.1 -p 5432 bosh -c "select blobstore_id from log_bundles where log_bundles.timestamp <= now() - interval '5 days';" | sed '/^$/d;s/^ //')