Running mongo server using systemctl on ubuntu@18.
Can confirm that it is using the right config file /etc/mongod.conf
I connect to mongo using mongodb nodejs package mongodb@4.6.0
The configuration file has changed since mongod was started and the running instance is in fact writing into a different file. In mongosh you might try
db.adminCommand( { getLog: "global" } )
to see if you can find log entries for initandlisten.
were issued replacing the file that mongod is writing into. But mongod is still writing in the original file handle of the file. Some people do that when they do not run logRotate and the file becomes too big with the false hope that the original file is truncated.
thank you. you are right. With the first command, I checked the logs were coming in fact.
Restarting the mongodb server fixed the issue. now I can see the logs in mongod.log.
And probably logrotate might be the culprit here. Is there anything wrong with my logrotate config that could have caused this issue?
I do not know enough about logrotate utility but you could look at
and
and
Of particular attention is the sentence:
reopen closes and reopens the log file following the typical Linux/Unix log rotate behavior. Use reopen when using the Linux/Unix logrotate utility to avoid log loss.
The default value is rename which seems to be incompatible with logrotate utility.