MongoDB – Where is the log file?

Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.

logpath

Check the MongoDB config file at /etc/mongod.conf or /yourMongoDBpath/mongod.conf, the logpath defined where to log.

/etc/mongod.conf

$ cat /etc/mongod.conf
# mongod.conf

# Where to store the data.

# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb3

#where to log
logpath=/var/log/mongodb/mongod.log

#...

References

  1. MongoDB – Rotate Log Files
  2. MongoDB – mongod options

8 comments on “MongoDB – Where is the log file?

  1. hi @mkyong, please, correct the mongodb log file path: “Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.”

  2. Chino de los cojones, deja en paz a la minoría negra, y tu micropene no es rival contra el vagina power que se nos viene encima.

Leave a Comment

Your email address will not be published. Required fields are marked *