Lab: Logging to a Different Facility [FAIL] “Mongod was started with the new logpath”

Passing the fork, but not the logpath.

I know there is another question like this but the answer says “Thanks for the note”. I’m having the same issue and dont know what the resolution is. Can someone elaborate please.
Thanks

Hi @John_82122,

I have moved your question to M103 discussion forum as it was in the M001 category.

Please share the content of your configuration file on personal message. I have inboxed you.

~ Shubham

Hi,

i have the same issue. I’ve set the configuration file so as to log as requested and for mongod to fork. The log directory is created and with the correct permissions. The mongod process starts, forks and logs correctly. The user was created as by test requirement.

I get everytime this message. I’ve tried to start both specifying and not the logpath in the command line options with the same result.

( I should add that the ide interface is awful with a small screen computer by the way but this is another problem.)

I’m getting frustrated for such a simple exercise, any idea?

If your lab asks you to start mongod with config file you have to follow it else test fails
Please share your config file
Did it come up successfully
Did you run test when it is up?

Yes, I did it using the config file. After the fails also tried doing it by command line arguments.
As I said, yes, the daemon starts OK, and the logging part works as by requirements and all.
Anyway, here’s the configuration file:

storage:
  dbPath: /var/mongodb/db
net:
  bindIp: localhost
  port: 27000
security:
  authorization: enabled
systemLog:
  path: "/var/log/mongodb/logs/mongod.log"
  destination: "file"
processManagement:
  fork: true

If I understood the requirements, the log config and fork part are configured correctly.

Anyway, please let me know.

Thanks!

Ok, the formatting is wrong in my previous post, I’ll send again the config file:

storage:
  dbPath: /var/mongodb/db
net:
  bindIp: localhost
  port: 27000
security:
  authorization: enabled
systemLog:
  path: "/var/log/mongodb/logs/mongod.log"
  destination: "file"
processManagement:
  fork: true

Reset your workspace and try again

Already done, 3 times …

Please show us a screenshot of your test result
Have you created the user in correct db?

I created the user doing copy and paste from the requirements, so …

Anyway, this is the user creation script I used / C&P:

mongo admin --host localhost:27000 --eval '
  db.createUser({
    user: "m103-admin",
    pwd: "m103-pass",
    roles: [
      {role: "root", db: "admin"}
    ]
  })

Sorry, forgot the screenshot of the result. It will follow very shortly. As for the user creation, i simply made a copy and paste of the exercise as so was said in there …

Anyway, screenshot (in the mean time this should be the 10th time i redo it and the integrated IDE doesn’t help much :frowning: )

(screenshots, so you can see all passages I’m doing)

[creating the log dir and setting owner]

[launched: mongod -f ./monfod.conf and then clicked on “Run tests” ]

Please make sure you are following the lab instructions.

From the lab instructions:

mongod sends logs to /var/mongodb/logs/mongod.log

But it looks like you used /var/log/mongodb/logs//mongod.log

I do not recall the lab instructions to mention anything about:

chown mongodb:mongodb …

Your prompt indicate user@M103, this is the user that starts mongod and this is the user that needs to permission to write in the log file directory.

From the screenshot it looks like you are running tail -f … and then start mongod before you are getting a new shell prompt. This does not work. You have to start mongod first and then you may tail the appropriate log file.

There is no problem tweaking the configuration file to experiment but you should not expect the validation script to accept your bifurcations without complaining about failed step.

2 Likes

Thank you.

  1. you are absolutely right on the log file path, my fault. Stupid error from my part.
  2. conseguence of my error 1), i got an error about writing on my wrong path. But in my wrong version of the lab mongod was running with id “mongodb” so i had to chown. I repeat in my wrong path.

Anyway, my fault. The additional /log/ … And thanks!

1 Like