Mongo provides the ability to control the log level for various features independently.
To control the precise log level MongoDb produces in the mongod log file, we need to log into MongoDb using the mongo shell and call the 'setLogLevel()' function to
set the logging level for the feature of interest.
dinesh> db.setLogLevel(5, "query") {
was: { verbosity: 0, accessControl: { verbosity: -1 },
assert: { verbosity: -1 },
command: { verbosity: -1 },
control: { verbosity: -1 },
executor: { verbosity: -1 },
geo: { verbosity: -1 },
globalIndex: { verbosity: -1 },
index: { verbosity: -1 },
network: { verbosity: -1,
asio: { verbosity: -1 },
bridge: { verbosity: -1 }, connectionPool: { verbosity: -1 } }, processHealth: { verbosity: -1 }, query: { verbosity: 5, optimizer: { verbosity: -1 }, ce: { verbosity: -1 }, rejected: { verbosity: -1 } }, queryStats: { verbosity: -1 },
replication: { verbosity: -1, election: { verbosity: -1 }, heartbeats: { verbosity: -1 },
initialSync: { verbosity: -1 },
rollback: { verbosity: -1 } }, sharding: { verbosity: -1, rangeDeleter: { verbosity: -1 },
shardingCatalogRefresh: { verbosity: -1 }, migration: { verbosity: -1 },
reshard: { verbosity: -1 }, migrationPerf: { verbosity: -1 } }, storage: { verbosity: -1, recovery: { verbosity: -1 },
journal: { verbosity: -1 }, wt: { verbosity: -1, wtBackup: { verbosity: -1 }, wtCheckpoint: { verbosity: -1 }, wtCompact: { verbosity: -1 }, wtEviction: { verbosity: -1 }, wtHS: { verbosity: -1 }, wtRecovery: { verbosity: -1 }, wtRTS: { verbosity: -1 }, wtSalvage: { verbosity: -1 }, wtTiered: { verbosity: -1 }, wtTimestamp: { verbosity: -1 },
wtTransaction: { verbosity: -1 }, wtVerify: { verbosity: -1 },
wtWriteLog: { verbosity: -1 } } }, write: { verbosity: 1 },
ftdc: { verbosity: -1 },
transaction: { verbosity: -1 },
tenantMigration: { verbosity: -1 },
test: { verbosity: -1 }, resourceConsumption: { verbosity: -1 },
streams: { verbosity: -1 } }, ok: 1 } dinesh>
mongod -vvworked for me