Failed to open "/home/vagrant/data/logs/mongod.log"

Hi there! I can’t manage to connect mongod. All the permissions on the data, logs and mongod.log have read and write.

Here is the error:

vagrant@m103:~$ mongod --config “/shared/config.conf”
2019-12-17T19:19:43.106+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open “/home/vagrant/data/logs/mongod.log”

config.conf file

dbPath: ‘data/db’
path: ‘data/logs/mongod.log’
destination: file
logAppend: true
port: 27000
authorization: enabled

Welcome @Diego_Hernandez_O_Hagan_03051

What’s happening here is data/db is a different location from /data/db. And also data/logs/mongod.log and /data/logs/mongod.log are different locations.

And if we look at the requirements:

Can you see the problem?

1 Like

Hi @Diego_Hernandez_O_Hagan_03051,

I hope you found the post #2 made by @007_jb helpful.

I would suggest you to get rid of the extra content in your configuration file. You will eventually get to use it in the subsequent labs.

If you still have any confusion then please feel free to get back to us.

Shubham Ranjan
Curriculum Support Engineer

when i type
cat data/log/mongod.log
iam getting error
cat: data/log/mongod.log: No such file or directory

You are probably missing the leading slash. So try cat /data/log/mongod.log.

Hi @SUJANA_42894,

I suspect you are getting this error because of the issue that @steevej-1495 mentioned.

Let me know if you are still stuck with the same issue.

Shubham Ranjan
Curriculum Support Engineer