The rocketchat_apps_logs.bson collection is huge, can we reduce or remove it?
-
Hi all,
This is a Rocket.Chat question rather than a Cloudron question, so apologies for coming here, but the Rocket.Chat forum seems to be about as useful as a chocolate teapot.
Our rocketchat_apps_logs.bson file within our docker container is huge: ~266Gb. So it's hogging a lot of useful space on our Cloudron server. I've no idea what's stored in here, but it feels like it might not be critical data. Does anyone know if there's a way to reduce or truncate it, or if it's safe to remove?
Cheers,
Rob -
@robw said in The rocketchat_apps_logs.bson collection is huge, can we reduce or remove it?:
as useful as a chocolate teapot
Great phrase ! https://english.stackexchange.com/questions/104958/origin-of-as-useful-as-a-chocolate-teapot-fireguard
-
@robw just guessing here, so do this with a backup. In settings -> apps, change the log destination to filesystem. Change it to something like
/app/data/app_logs
(whichcloudron
as owner) . By default, it seems to save logs to the mongodb database. Once you verify that something is getting created in the filesystem, maybe you can run some mogodb commands to remove the app_logs collection. -
Again with some warning that I am just guessing my way here:
- Open mongodb prompt . Rocket.Chat Web Terminal -> MongoDB button on top.
db.getCollection('rocketchat_apps_logs').countDocuments()
I guess this prints how many documents are there. In my empty instance this is 0db.getCollection('rocketchat_apps_logs').deleteMany({});
this nukes all entries in that collection
-
Hello @girish
We run into the same issue with
rocketchat_apps_logs.bson
being too large.It's stored in the /var/lib/docker/volumes/569e4faada8ec760513bad87aa4c494f4792ebf6e5ef0dbd3f9f539d8a0b0ab6/_data/e95dbcf8-8480-47a3-834f-ea3dfbede698 folder.
I though that if we disable Cloudron backups for Rocket.chat these files will stop being created but it seems it did not help.
The problem is that the rocketchat_apps_logs table suddenly gets thousands of rows every day and the
rocketchat_apps_logs.bson
backup file that is created for it is much bigger than the database size of the table. I got about 10 GB file for 2 GB of Mongodb table sizeI tried to change the "Apps' Source Package Storage type" in Rochat.chat as you suggested.
Thanks,
Martin -
Hello @girish
I did use similar backups and then the
rocketchat_apps_logs.bson
file got much smaller.However it only took 3 days and it was too big once again.
So I was wondering if that file has anything to do with Cloudron backups
rocketchat_apps_logs.bson
as it seems to be created then. But as I said I disabled Cloudron backups for Rocket.chat and these files in /var/lib/docker/volumes/569e4faada8ec760513bad87aa4c494f4792ebf6e5ef0dbd3f9f539d8a0b0ab6/_data/e95dbcf8-8480-47a3-834f-ea3dfbede698 still got created tonight.Thanks,
Martin -
-
@girish I tried with this in Cloudron Crontab:
0 * * * * mongosh -u "${CLOUDRON_MONGODB_USERNAME}" -p "${CLOUDRON_MONGODB_PASSWORD}" ${CLOUDRON_MONGODB_HOST}:${CLOUDRON_MONGODB_PORT}/${CLOUDRON_MONGODB_DATABASE} --eval "const collection = db.getCollection('rocketchat_apps_logs'); const toDelete = collection.find().sort({ _createdAt: -1 }).skip(1000); toDelete.forEach(doc => collection.deleteOne({ _id: doc._id }));"
It seems to work.
Update: Fixed the schedule to happen once per hour.