Writing to log file failed, aborting application

Hi,

My MongoDB version is 5.0.18.
mongod.log is under /var/log/mongodb and data is located in /var/lib/mongo.
They are mounted on totally different partitions.

Several days ago, slow queries flooded the mongod.log and exhausted the disk space.
Then, as the title, mongod crashed.

It looks like by design, but

Is there anyway to prevent mongod from crash like this?

mongod crashing is a disaster in anyway, but losing mongod.log doesn’t hurt so much.

Hi @Hailin_Hu,
Can you do a custom script, where you can define the limit of maximum size of logs and retetion of them.

Regards

Mongodb has no built in support for logrotate.

You have to use some external tools to manage log files

Thank you, guys.
I’m working on logrotate to manage the disk space better.

But it would be great if mongod can keep alive when it failed to log.