This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to VietTUG.org

mongodb log rotating

Mongodb buggy
Added by ruby 5 months ago  »  Votes: 3/3

Put this script in /etc/cron.dailiy/foobar.sh

 1 #!/bin/bash
 2 
 3 # Purpose: rotate mongodb logs
 4 # Author : Multiple authors
 5 # Date   : 2012 Aug 25th
 6 
 7 # See also http://www.mongodb.org/display/DOCS/Logging
 8 
 9 # First rotate the logs as per instructions above
10 mongo admin --eval "db.runCommand('logRotate')" 
11 
12 # gzip the rotated logs
13 find /var/log/mongodb -type f -name "*\.log\.*" -print -exec gzip {} \;
14 
15 # if disk space is an issue, purge or move these if older than 3 days
16 find /var/log/mongodb -type f -name "*\.gz" -mtime +3 -print -exec rm {} \;

Comments