Issue
There is a linux mongo instance wherein the mongo logrotation has been set:
/etc/logrotate.d/mongodb
/var/log/mongodb/mongod.log {
rotate 7
daily
size 500M
copytruncate
missingok
create 0600 mongodb mongodb
dateext
delaycompress
compress
}
But the /etc/logrotate.conf file has the following configuration:
weekly
su root syslog
rotate 4
create
include /etc/logrotate.d
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}
The question here is, will the mongo logrotation happen daily as specified in /etc/logrotate.d/mongodb or will it happen weekly as it has been specified in /etc/logrotate.conf ?
Also how do I know/ensure if the logrotation is actually happening, through cron ?
Solution
logrotate
must be run by cron
. On Ubuntu 18.04 cron
runs logrotate
daily, see /etc/crontab
and /etc/cron.daily
. You can also run it manually.
Global weekly
is the default, /etc/logrotate.d/mongodb
overrides it with daily
.
Answered By - Maxim Egorushkin Answer Checked By - Marilyn (WPSolving Volunteer)