...
- Open a terminal session to your Opmantek server
- Find the location of your mongod.log file. This can be done by cat /etc/mongod.conf you will find the log location under the systemLog section. Copy the full path and paste it in a notepad for later.
- Making your logrotate mongod file: (**Note this is the default we ship with in our VM. Depending on your company standards it may need edits)
vi /etc/logrotate.d/mongod.conf
Code Block language bash title /etc/logrotate.d/mongod.conf # Replace /var/log/mongodb/mongod.log with your log location (step 1) if different /var/log/mongodb/mongod.log { weekly maxsize 500M rotate 50 missingok compress delaycompress notifempty create 640 mongod mongod sharedscripts postrotate kill -SIGUSR1 $(pidof mongod) >/dev/null 2>&1||: endscript }
- Save and quit
- Check permissions and ownership of the new conf file: ls -al /etc/logrotate.d/
- Testing your new logrotate: logrotate --debug /etc/logrotate.d/mongod.log
- Any errors you have will appear in your output.
...