Main Tutorials

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

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
8 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
zero
4 years ago

dbpath=/var/lib/mongodb3 is this syntax correct, because in my configuration file its like a

dbPath: /var/lib/mongodb
HitchU
6 years ago

Nice article.

Kulpa
2 years ago

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.”

vanajakhi
3 years ago

I could see my mongod service is not running but able to connect to database.
How its possible

xdxddxdxd
5 years ago

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.

hdp
6 years ago

chino represor de mujeres y negros

Mak
4 years ago
Reply to  hdp

Su madre verga

Yorrick Thorvald Whitemansson
5 years ago
Reply to  hdp

laughed so much. mkyong is probably not even chinese