The log is 15 Gigabytes. I guess I have to back it up and delete. I have enough hard disc space, but did not realize log was so large. And overnight cron jobs suddenly started to die in the middle.

  • What exactly are these cron jobs doing? – Nick Chammas Jun 5 '12 at 18:02
  • actually they are compute-heavy, looking at every entry of every user, constantly accessing the database. The "cursor not found" error from MongoDB that I am getting is typically an indication that the cursor (query) timed out (after 10 minutes of inactivity). – Tyra Jun 5 '12 at 18:07
  • @Tyra Could you provide a bit more detail about this cron job? Additionally, what is the log that you're analyzing? logrotate may help you get the logs to a manageable size. – swasheck Jun 5 '12 at 19:03
  • My schedule.rb file is setting the output as "set :cron_log, "/opt/webapps/xxx/cron_log.log" Logrotate sounds useful. For now I just deleted the log and am running the job again. So far so good, but a log is 500 MB long in just an hour! – Tyra Jun 5 '12 at 19:31
  • This cron job is accessing the database, getting a few entries according to criteria, computing something with the values, getting another set of entries, computing, until all thousands of entries are processed. It dies right before the computing part, every time in different places. Seemed to work on my laptop. – Tyra Jun 5 '12 at 19:43

If you are talking about the MongoDB log file becoming too large you should take a look at the log rotation options here:


Short version - you can rotate the logs via an admin command within MongoDB or you can send a SIGUSR1 - combine with your favorite log management method and you should be good.

Something else to consider though is why the log is so large - unless it has been running for a long, long time, 15GB is a lot of logging. You may want to make sure that you are not starting up with logging set too high (-vv etc.). You can also check the log level with the setParameter command. For example, to set to 0 (the default), without restarting, just issue it like this:

db.adminCommand({setParameter:1, logLevel:0})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.