How to setup log rotation for MongoDB properly

Hello there,
I’m setting up the log rotation of systemLog files. In my .conf file the section systemLog is the following:

destination: file
logAppend : true
logRotate: rename

The configuration file of the logrotate is the following:

size 15K, *it's just a size to test*
rotate 7
create 0640 mongod mongod

I’m kindly ask what are the correct and/or useful parameters to use to have enough log file size and frequency of the rotation. Thank you in advance.

I don’t recall there’s a “log rotate file size threshold” from official doc.

it’s no such exists, you may have to monitor the log file size externally (e.g. with a tool) and once the number is reached, send a siguser to mongod.

Hello there,

looking around the cyberspace I set up the following .conf file in a test environment to get some experience then to apply on production environment. I still I don’t understand why it’s needed to send a siguser to mongod as a postrotate even if, it’s seems to me, the rotation is working.

/var/log/mongodb/mongod.log {
rotate 4
date %Y-%m-%d-%s
create 0640 mongod mongod