i have installed the mongodb on my ubuntu server and also installed the logrotation in my server to rotate the log and create a new log with the data
/etc/mongod.conf
# wiredTiger:# where to write logging data.systemLog: destination: file logAppend: true logRotate: reopen path: /var/mongodb/log/*.log# network interfacesnet: port: 27017 bindIp: 0.0.0.0# how the process runsprocessManagement: timeZoneInfo: /usr/share/zoneinfosecurity: authorization: enabled#operationProfiling:#replication:#sharding:## Enterprise-Only Options:#auditLog:
/etc/logrotate.d/mongodb
/var/log/mongodb/mongod.log {# state /var/lib/logrotate/status-mongodb hourly rotate 96 size 100M missingok create 0600 mongodb mongodb notifempty compress delaycompress sharedscripts postrotate if /usr/sbin/pidof -s mongod > /dev/null ; then kill -USR1 $( /usr/sbin/pidof mongod ) ; fi /bin/kill -SIGUSR1 `cat /var/run/mongodb/mongod.pid 2>/dev/null` 2> /dev/null || true# /bin/kill -SIGUSR1 `cat /var/lib/mongo/mongod.lock 2> /dev/null` 2> /dev/null || true# /bin/kill -SIGUSR1 $(cat /var/run/mongodb.pid)# systemctl restart mongod >/dev/null 2>&1 || true endscript}
logrotate.conf
# see "man logrotate" for details# global options do not affect preceding include directives# rotate log files weekly*/15# use the adm group by default, since this is the owning group# of /var/log/syslog.su root adm# keep 4 weeks worth of backlogsrotate 4# create new (empty) log files after rotating old onescreate# use date as a suffix of the rotated file#dateext# uncomment this if you want your log files compressed#compress# packages drop log rotation information into this directoryinclude /etc/logrotate.d# system-specific logs may also be configured here.
I have mentioned this all, but still there is no success of rotating the logs and logs are not getting written.
I tried changing the configuration forcefully started the logrotation, even tried to put the cron for it to create a log but still there is no success.