MongoDB – How to Automatically Rotate Logs in mongod.conf

mongodb

cureetly we are not having log rotater in my mongod.conf file.my version is mongodb3.4.3 how can i give log rotater in my mongod.conf file please check my conf file and give me suggestion where to add the log rotator in my conf fileand what to addenter image description here

Best Answer

If you are using *nix system, you have few choices. You can use logrotate service and send SIGUSR1 signal to mongod/mongos process. Or you can change your config systemLog.logRotate: rename and again send SIGUSR1.

To rotate log you can give command db.adminCommand( { logRotate : 1 } ) too.

How you do it on the windows side, that I don't know.