Search This Blog

Showing posts with label Mongodb. Show all posts
Showing posts with label Mongodb. Show all posts

Friday, November 4, 2016

mongodb 3.2 logrotate

Installed latest mongodb 3.2 on Debian 8 Jessie.

It does not came with logrotate configure file.

Here is mine:

Add reopen in /etc/mongod.conf


systemLog:
  logAppend: true
  logRotate: reopen


Using -SIGUSR1 to rotate the log file:

/etc/logrotate.d/mongodb


/var/log/mongodb/*.log {
    daily
    rotate 10
    dateext
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -SIGUSR1 `cat /var/lib/mongodb/mongod.lock 2> /dev/null` 2> /dev/null || true
    endscript
}