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:

systemLog:
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
compress
delaycompress
create 0640 mongod mongod
copytruncate

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 {
weekly
rotate 4
dateext
date %Y-%m-%d-%s
missingok
create 0640 mongod mongod
copytruncate
endscript
}