Relating to mongodb's documentation, database commands such as count
will be logged as component COMMAND. However neither db.count()
nor db.runCommand({count:'mycollection'})
produces a COMMAND log entry, even if the default log level for COMMAND is raised from 0 to 1.
Dropping an index, a collection or a database produces a COMMAND log entry even with the default log level 0 though.
Moreover, it seems that almost all mongodb actions can be expressed as command (even a find
), as shown in mongodb's documentation, so I wonder how one could properly differentiate between QUERY which logs messages related to queries and COMMANDs.
My goal is to filter out (administrative) commands from the logs for auditing (and I don't want to use mongodb's enterprise version with auditing functionalities for this single purpose).
I'm using mongodb version 4.0.5 Linux 64Bit.
Thanks for shedding light on this!
Best Answer
After setting the verbosity level for
command
as 1, I am able to see the following entries in the log filehere the collection name is
icons
and the database istest
I used the following command to increase the verbosity level.