Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Rotation des log

Avec un simple mongo

Avec un cluster mongo

Pour mettre en place vous même la rotation des log, il faut rajoutez deux entrées au fichier /etc/crontab


Code Block
languagebash
themeEmacs
titleRajout de la rotation des logs mongo dans /etc/crontab
# A 3h01 on demande a mongo de rotationner son log
1 3 * * * root kill -USR1 `cat /var/run/mongodb/mongod.pid`
1 3 * * * root test -e /var/run/mongodb/mongos.pid && kill -USR1 `cat /var/run/mongodb/mongos.pid`
1 3 * * * root test -e /var/run/mongodb/mongo-configsrv.pid && kill -USR1 `cat /var/run/mongodb/mongo-configsrv.pid`

#A 3h02 on supprime les logs plus vieux de 7jours
2 3 * * * root find /var/log/mongodb/ -name "*.log.*" -type f -mtime +7 | xargs /bin/rm -f


Et ensuite relancer le daemon crond:

Code Block
languagebash
themeEmacs
titleRelance de crond
service crond reload