In this article, we will see How to find MongoDB log file path in Linux environment. There are different methods to find MongoDB log file path.
Method1: find MongoDB log file path using mongod.conf file:
By Default, MongoDB creates the log file at this path “/var/log/mongodb/mongodb.log”, if the log file is not found at this path, please check with the MongoDB config file.
more /etc/mongod.conf
systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log
Method2: find MongoDB log file path using command:
The easiest way to find MongoDB log file path is using getCmdLineOpts command:
db.getSiblingDB("admin").runCommand({getCmdLineOpts:1})
"systemLog" : { "destination" : "file", "logAppend" : true, "path" : "/var/log/mongodb/mongod.log" }
So, in this article we have seen two methods to findout MongoDB log file path.