jameszhou
jameszhou

Reputation: 31

MongoDB- Customzieable log size and growth strategy

I have been running MongoDB for some time. There brings about a issue deserved to be paid.

My customzie log strategy like below: 1) Limit a maximum size of 50MB for each log file 2) Limit a total of 7 log files under the specified log path

How can I implement such things in MongoDB?

Thanks In Advance!

Upvotes: 0

Views: 351

Answers (1)

Nick
Nick

Reputation: 1554

You'll need to write a cronjob that checks the size of the log file, and if it is greater than 50MB it sends your mongodb process a SIGUSR1 (signal number 10). This will then rotate the mongodb logs.

Upvotes: 2

Related Questions