Disabling mongo.log

Apr 2, 2017

In many installations of MongoDB verbose logging to the mongo.log file is switched on by default. This file can grow to quite substantial size (hundreds of megs are added regularly) and cleaning the file manually every time is rather tedious.

MongoDB recommends rotating logs but on local dev machines you aren’t likely to actually need these logs in the first place.

To disable them edit /usr/local/etc/mongod.conf file (or whenever your mongo config is located - check the arguments provided to mongod with ps aux | grep mongod).

In mongod.conf comment out the logpath line. Restart the service and the logs won’t be collected anymore. You may want to still remove that file (look in /usr/local/var/log/mongodb/mongo.log)