HiveBrain v1.2.0
Get Started
← Back to all entries
snippetdockerMinor

How to disable mongodb connection logs?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
logsdisablemongodbhowconnection

Problem

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? Tha

Solution

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)";
}

Code Snippets

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

Context

StackExchange Database Administrators Q#191632, answer score: 4

Revisions (0)

No revisions yet.