Adding parameters to the configuration file
Logpath=/data/app_data/mongodb/log/mongodb.log Logappend=true
Only this kind of log rotation in Windows
> Use admin;switched to DB admin> Db.runcommand ({logrotate:1}) {"OK": 1}
Linux can also be set by setting a scheduled task every morning to rotate the log
0 0 * * */bin/kill-sigusr1 ' cat/data/app_data/mongodb/data/mongod.pid '
View Logs
-rw-r--r-- 1 mongod mongod 13m apr 1 20:47 mongodb.log-rw-r--r-- 1 mongod mongod 332K Dec 20 2013 mongodb.log.2013-12-19t16-00-01-rw-r--r-- 1 mongod mongod 1.7m dec 21 2013 mongodb.log.2013-12-20T16-00-01-rw-r--r-- 1 mongod mongod 1.9m dec 22 2013 mongodb.log.2013-12-21t16-00-01-rw-r--r-- 1 mongod mongod 2.3m dec 23 2013 mongodb.log.2013-12-22t16-00-02-rw-r--r-- 1 mongod mongod 2.3m dec 24 2013 mongodb.log.2013-12-23t16-00-01-rw-r--r-- 1 mongod mongod 2.7M Dec 25 2013 mongodb.log.2013-12-24t16-00-01-rw-r--r-- 1 mongod mongod 2.5m dec 26 2013 mongodb.log.2013-12-25t16-00-01
The log after rotation is the file name suffix in UTC time stamp.
Reference Documentation:
http://docs.mongodb.org/v2.4/tutorial/rotate-log-files/
This article is from the Linux SA John blog, so be sure to keep this source http://john88wang.blog.51cto.com/2165294/1627466
MongoDB Log Rotation