0

We got a performance issue on our Python Web Application and it was resolved when i did the log rotation on MongoDb,

db.adminCommand( { logRotate : 1 } )

it seems that the cause of the issue is related with the mongodb.

Why do we need to log rotate mongodb? Is there anything we can check/monitor when do we need to log rotate? What are the things we need to check if encounters mongodb related issues?

Sam XYZ
  • 3
  • 1

1 Answers1

0

Purpose is to prevent the log file from getting to big. It the same principle with almost any log files. If the log files get to big you might: * start running out of disk space * write times get slower (depends) * if something parses that log it will have a harder time doing it, in extreme cases (I've seen solutions that loaded the whole log file to memory for processing...) it might cause those parsers to crash * it's harder to navigate and archive

Mongodb has a built-in to manage log rotation -- controlled by the command you mentioned. It can probably be also managed by logrotate (mother of log rotation solutions).

Also check out this SO question.

guessimtoolate
  • 8,372
  • 2
  • 18
  • 26
  • Do you know the capacity of the mongodb size? How can we check if the mongodb is running out of disk space? – Sam XYZ Nov 01 '17 at 16:01
  • Thank you for your answer! :) – Sam XYZ Nov 01 '17 at 16:01
  • Well, I'd rather check the available space on the server running mongodb. Usually you want to have some sort of alerting system in place that will notify you when you exceed a given capacity threshold e.g. disk is 80% full. If you want to do it manually then a simple `df -h` will do. – guessimtoolate Nov 01 '17 at 19:45
  • Hi Sir, Thanks! It helps a lot. :) Hope i can help you someday. – Sam XYZ Nov 08 '17 at 11:13