1

OS: Windows 10/ Server 2012

Mongodb verison : 3.4.9

I have set the mongod --logPath and --quiet command line parameter

The logs are just growing beyond 100mb and not rotating. Seeing the logs I see lot of entries example:

I COMMAND [conn9] command DBNAME.VERSIONS command: find {

How can I restrict mongodb to log these as I really do not care about the command

  • @Stennie, Sherry mentioned in the question that --quiet parameter is used when starting the mongod. Still the operations slower than 100ms are logged in log file? – Mani Mar 9 at 6:25
  • 1
    (reposting my comment which was slightly mangled): How long are these commands taking to run (i.e. the timing at the end of the log line)? All commands slower than the --slowms threshold. What does the timing at the end of the log line look like? Slow commands (default: 100ms) will be logged. You could increase this threshold if you have a high tolerance for slow queries or don't want to see them logged. – Stennie Mar 9 at 9:07
  • @Mani The --quiet parameter limits some diagnostic output like connection accepted/closed events and replication activity, but slow commands have a separate threshold. Normally admins would want to have slow commands/queries logged for investigation. Anoher option to limit logging would be to configure log rotation, which is managed outside of the MongoDB server. For example, using logrotate on Linux to send a signal to rotate the logs. – Stennie Mar 9 at 9:16
  • Sorry for the late reply. So commands are taking more than 100ms, for examle "I COMMAND [conn63] command admin.$cmd command: listDatabases" is about 120ms Which makes me think why these are taking so long? Also another entry which is showing up too much are "I NETWORK [conn28] received client metadata from" How can I stop these? – SomeGuyWhoCodes Mar 9 at 15:32
0

To increase the slowms value , follow the below steps:

For Exmple, If you want to increase the slowms vlaue to 500ms

db.setProfilingLevel(1, 500)

It will set the slowms to 500ms and will also turn on the profiling. So to stop the profiling, run the below command.

db.setProfilingLevel(0)

This can also be done by restarting MongoDB with the --slowms option.

Now, the commands will get logged in the log file only when the command takes more than 500ms to execute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.