How to automatically clear / rotate statistics

Description

I noticed that the mongo collection which contains the server statistics has been running quite large over time. In fact it is the largest table now, exceeding the size of the message collection:

-rw-r--r-- 1 mongodb daemon 454M May  7 00:02 rocketchat_message.bson
-rw-r--r-- 1 mongodb daemon 496M May  7 00:02 rocketchat_statistics.bson

Looking inside, it seems the all entries since the installation in 2017 have been kept. Apparently the is no auto-rotation. Searching in the settings in admin GUI, I couldn’t find anything to configure that.

Is there anything built in to do that, or do I have to remove the old collection entries regularly directly in the MongoDB?

Server Setup Information

  • Version of Rocket.Chat Server: 7.5.1
  • Operating System: Arch
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: 20.19.0
  • MongoDB Version: 8.0.4-1
  • Proxy: nginx
  • Firewalls involved: -

I’ve asked devs.

Please be patient.

In a word - no not easily.

The only automated solution is via retention policies which is fine unless you want to retain the messages..

I suggest opening a well documented bug.

I see. Thanks for taking your time to figure it out. I will open an issue about it.