I have setup 3 replicas on mongodb. I am facing a lot of mongoDb logs in the log file of mongodb, and I want to minimize the logs to show only errors, warning and critical logs but not for connection and access. to which verbosity level I should have to set the logs?
My current setting for logs in config file:
systemLog:
destination: file
logAppend: true
path: /data/log/mongodb/mongod.log
component:
accessControl:
verbosity: 1
command:
verbosity: 1
# COMMENT some component verbosity settings omitted for brevity
replication:
verbosity: 1
election:
verbosity: 1
heartbeats:
verbosity: 1
initialSync:
verbosity: 1
rollback:
verbosity: 1
storage:
verbosity: 1
journal:
verbosity: 1
recovery:
verbosity: 1
write:
verbosity: 1
And one more question, Do logs make any impact on mongoDb performance? e.g. If my mongoDb logs file will goes upto 30GB of size in a day, will it impact on mongodb performance?
Default level is
0, i.e. level1will even increase the amount of logs. Remove everything belowcomponentto use default logging and increase it only the for the component where you like to get more detailed logs.First, you may check which component creates the most logs.
I reduced the size of logfiles significantly by setting
operationProfiling.slowOpThresholdMsto a higher value. Default threshold for "slow operation" is 100 Milliseconds which is fairly low I would say.