Automatically rotate the files in the MongoDB

939 views
Skip to first unread message

ajduke

unread,
Nov 20, 2012, 12:08:18 AM11/20/12
to mongod...@googlegroups.com
The log rotate does the work when done manually by running the command.

Does mongo have any thing as such which rotate file when certain log file limit is reached ?

Andre de Frere

unread,
Nov 20, 2012, 12:23:42 AM11/20/12
to mongod...@googlegroups.com
Hi,

MongoDB does not currently automatically rotate logs.  You would need to do this as part of a cron job or similar.

There is an open SERVER ticket for you to comment and vote on at https://jira.mongodb.org/browse/SERVER-4797

Regards,
André

Andre de Frere

unread,
Nov 20, 2012, 1:27:17 AM11/20/12
to mongod...@googlegroups.com
Hi,

I should also mention the ability to log to syslog, which is a new feature in 2.2.

You can find more information on this option in the following places:


Regards,
André

ajduke

unread,
Nov 23, 2012, 3:53:12 AM11/23/12
to mongod...@googlegroups.com
Thanks Andre for reply.

When this feature will be included, any idea on this ?

Andre de Frere

unread,
Nov 25, 2012, 7:08:18 PM11/25/12
to mongod...@googlegroups.com
Hi,

This feature is currently planned but not scheduled.  I encourage you to vote and comment on the Jira ticket if this feature would be useful to you, so that we can more accurately prioritise any work to be done.

Cheers,
André

ajduke

unread,
Nov 25, 2012, 11:34:13 PM11/25/12
to mongod...@googlegroups.com
Okay, sounds great.
Thanks André.

HYG_cn

unread,
Nov 26, 2012, 1:43:02 AM11/26/12
to mongod...@googlegroups.com
Hi Andre:
        That's really a feature needs to be done,the log is very big and we can not make it quiet because we may analyze the log to see if something goes wrong.Now we use "killall -SIGUSR1 mongod" to rotate the log,is that right?Is there some potential harm to the mongod?

HYG 

HYG_cn

unread,
Nov 26, 2012, 1:44:53 AM11/26/12
to mongod...@googlegroups.com
Hi Andre:
        That's really a feature needs to be done,the log is very big and we can not make it quiet because we may analyze the log to see if something goes wrong.Now we use "killall -SIGUSR1 mongod" to rotate the log,is that right?Is there some potential harm to the mongod?

HYG 

On Monday, November 26, 2012 8:08:19 AM UTC+8, Andre de Frere wrote:

Stephen Steneker

unread,
Nov 26, 2012, 2:07:52 AM11/26/12
to mongod...@googlegroups.com
 
        That's really a feature needs to be done,the log is very big and we can not make it quiet because we may analyze the log to see if something goes wrong.Now we use "killall -SIGUSR1 mongod" to rotate the log,is that right?Is there some potential harm to the mongod?

Hi,

As noted on the Logging page, SIGUSR1 on Linux can be used for log rotation:

This won't cause any "harm" to the mongod, however as also noted on the logging page there is a potential bug to be aware of:

The current recommendation to avoid SERVER-4739 is to instead use the logRotate command from the mongo shell.

It's also worth noting that the --syslog option added in MongoDB 2.2 will let you use standard syslog features like filtering & log rotation.  With syslog filtering you can generally use regular expressions to separate messages of interest into different log files (or suppress those that are just noise).

For example, Rsyslog is the current default for Ubuntu Server 10.04+:

Cheers,
Stephen

Orizon H

unread,
Nov 26, 2012, 2:28:02 AM11/26/12
to mongod...@googlegroups.com
Hi Stephen:
         Thanks for your answer.

Cheers,
HYG

2012/11/26 Stephen Steneker <stephen....@10gen.com>

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Reply all
Reply to author
Forward
0 new messages