We are using Mongo db Shard set up. What i see that on primary of each shard log file keep growing to GBs. Even in a day it reaches to 10GB for single day.
This appears to be slowing down Mongo over time.
I would like to have Mongo automatically rotate the log once it reaches, say, 100MB. I've looked at the Mongo documentation, the standard Mongo package does not appear to support automatic log rotation based on size.
I also need to know why log file on primary grows so much.
Please help us with this.
Thanks
Best Answer
If you are using Linux or Unix as your platform, you could setup a shell script that monitors the size of the log files, and send the SIGUSR1 signal to mongod which forces it to cycle the log files once the files reach a certain size.
This Mongo documentation shows how to send the signal here
You can get the
<mongod process id>
using: