MongoDB Log Rotation

Source: Internet
Author: User
Tags utc time stamp

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.