mongodb at some point stops logging events in the mongodb.log. the mongod process results up.

version Mongodb 4.4 Replica Set ( PSA )

linux operating system CentOS Linux release 7.9.2009 (Core).

-rw------- 1 mongod mongod 0 Mar 14 09:48 mongodb.log

  • 1
    Do you use logrotate or something?
    – mustaccio
    Apr 15 at 13:20
  • Hard to believe. What is the last logging entry in the file? Apr 15 at 15:02
  • use the following file to rotate the logs: /var/log/*.log { noolddir daily rotate 7 compress dateext missingok notifempty sharedscripts postrotate /bin/kill -SIGUSR1 cat /var/run/mongod/mongod.pid 2> /dev/null 2> /dev/null || true endscript } why MongoDB does not register in the log file? what is the solution to adopt to solve the problem?
    – Mongoboy
    Apr 19 at 8:15

1 Answer 1


mongodb gets angry that you changed its file.

You choose two ways for re-logging. first of all, log rotation and secondly db instance bounce.

  1. you can use logrotate command. Doc: LogRotate

db.adminCommand( {logRotate: 1 } )

  1. bounce database

systemctl restart mongodb

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.