I get this message when I run “validate_lab_different_logpath”. Obviously I can update my config file and restart MongoDB etc but I don’t see where it has been stated or suggested or hinted (!) that I need to set this value for the lab beforehand, have I missed something?
Perhaps… the subtle hint was in this section.
Note: Using db.setProfilingLevel() will not work for this lab, because this command will not persist data in the config file - if the mongod process shuts down, such as during a maintenance procedure, the profiling level set with db.setProfilingLevel() will be lost.
Which leads to finding out how to persist the logs
However just like the follow say:
If you receive an error, it should give you some idea of what went wrong.
And you figured it out!
True, but I still don’t see what log append hs to do with the profiling, if I didn’t set it profiling would still work.
Also, related, WHY doesn’t db.setProfilingLevel() press through MongoDB restarts? Intuitively it would seem that it should? Does db.setLogLevel() persist through restarts or not? How can I find out?
Like I said it was a subtle hint… maybe not very good…
The profiler is
offby default. You can enable the profiler on a per-database or per-instance basis at one of several profiling levels.
So IMHO it is more reasonable to assume it will be off unless explicitly set each time started.
Im not sure. But to be certain I would include any changes from the default in the Config file
This is my config file:
bindIp : “127.0.0.1,192.168.103.100”
This is my command to run mongod:
mongod --port 27000 --config /var/mongodb/db/config.txt --logpath /var/mongodb/db/mongod.log --fork
This is what i get running validate:
You need to specify the millisecond threshold for slow operations.
I have tried setting profile levels but the error persists
Not to sure at this point. Sorry…
Perhaps this may help
I think you are missing the following from the requirements of the lab:
any query that takes 50ms or longer is logged (remember to specify this in the configuration file!)
And as I complete my reply I see that natac13 already pointed you on how to fulfill that last requirement.
Thanks, i did not notice that.
Instead of doing it in the config file, I used --slowms 50 directly in the command and it worked
That’s good but I would recommend using the configuration file way of doing it. In these courses, you sometime build a configuration file from lab to lab and you need the options of the previous lab in the next lab.
I personally put my configuration under git so I can see the changes I made from lab to lab to accomplish the final result. Command line history is good but nothing beats a good commit log.
Thanks. I already put it in the config file.
@dgiffin, db.setLogLevel() does not persist through restart.
Please get back if you have any further queries.
Curriculum Support Engineer
Hi @Mathias_11469 it’ll be better if you create your own new thread. Your error isn’t directly related to this one.