1

Our mongodb relication has many logs like this:

>     2017-11-24T02:15:50.679+0000 I ACCESS   [conn6537] Successfully authenticated as principal stats on stats
>     2017-11-24T02:15:50.679+0000 I ACCESS   [conn6535] Successfully authenticated as principal stats on stats
>     
>     2017-11-24T02:15:51.150+0000 I -        [conn6535] end connection :49982 (13 connections now open)
>     2017-11-24T02:15:51.150+0000 I -        [conn6536] end connection 
> 
> 2017-11-24T02:33:09.187+0000 I NETWORK  [thread1] connection accepted
> from 2017-11-24T02:33:09.187+0000 I NETWORK  [thread1] connection
> accepted from 2017-11-24T02:33:09.187+0000 I NETWORK  [thread1]
> connection accepted from

Our config:

db.getLogComponents();

{
        "verbosity" : 0,
        "accessControl" : {
                "verbosity" : -1
        },
        "command" : {
                "verbosity" : -1
        },
        "control" : {
                "verbosity" : -1
        },
        "executor" : {
                "verbosity" : -1
        },
        "geo" : {
                "verbosity" : -1
        },
        "index" : {
                "verbosity" : -1
        },
        "network" : {
                "verbosity" : -1,
                "asio" : {
                        "verbosity" : -1
                },
                "bridge" : {
                        "verbosity" : -1
                }
        },
        "query" : {
                "verbosity" : -1
        },
        "replication" : {
                "verbosity" : -1
        },
        "sharding" : {
                "verbosity" : -1
        },
        "storage" : {
                "verbosity" : -1,
                "journal" : {
                        "verbosity" : -1
                }
        },
        "write" : {
                "verbosity" : -1
        },
        "ftdc" : {
                "verbosity" : -1
        },
        "tracking" : {
                "verbosity" : -1
        }
}

How can I disable these logs? Thank you!

  • which MongoDB version, you are using? – Md Haidar Ali Khan Nov 24 '17 at 15:50
  • First thing , why you want to disable mongodb connection logs? – Md Haidar Ali Khan Nov 24 '17 at 16:01
1

With "quiet" configuration parameter (not recommended) you get rid of:

  • "Successfully authenticated as..."
  • "connection accepted from ..."

but "end connection ..." still stays there and there is no way to remove it, without changing source code. You can always ask developers to change code to

if (!quiet) { 
  const auto word = (connectionCount == 1 ? " connection"_sd : "connections"_sd);
  log() << "end connection " << remote << " (" << connectionCount << word << " now open)";
}
0

As per MongoDB BOL db.getLogComponents() Returns the current verbosity settings. The verbosity settings determine the amount of Log Messages that MongoDB produces for each log message component.

As the default db.getLogComponents() returns a document with the verbosity settings.

{
   "verbosity" : 0,
   "accessControl" : {
      "verbosity" : -1
   },
   "command" : {
      "verbosity" : -1
   },
   "control" : {
      "verbosity" : -1
   },
   "geo" : {
      "verbosity" : -1
   },
   "index" : {
      "verbosity" : -1
   },
   "network" : {
      "verbosity" : -1
   },
   "query" : {
      "verbosity" : 2
   },
   "replication" : {
      "verbosity" : -1
   },
   "sharding" : {
      "verbosity" : -1
   },
   "storage" : {
      "verbosity" : 2,
      "journal" : {
         "verbosity" : -1
      }
   },
   "write" : {
      "verbosity" : -1
   }
}

If you want to modify any of these (verbosity) settings , you can configure the systemLog.verbosity and systemLog.component.<name>.verbosity settings in the configuration file or set the logComponentVerbosity parameter using the setParameter command or use the db.setLogLevel() method.

As the verbosity level can range from 0 to 5:

1. 0 is the MongoDB’s default log verbosity level, to include Informational messages.

2. 1 to 5 increases the verbosity level to include Debug messages.

For further your ref systemLog.verbosity and Log Messages

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.