We are using mongodb version 3 in a AWS environment with Linux AMIs.
Initially mongo was logging the entire document. We then lowered the verbosity in the yaml. That seemed to make most (99%) of the documents to not get logged. However we still find that it occasionally still logs the record. It seems to do a WRITE and then a COMMAND and both contain the entire record.
Is there anyway to ensure the document never gets written to the log while still having useful logging?
Thanks
systemLog:
quiet: true
destination: file
path: /var/log/mongodb.log
logAppend: true
logRotate: rename
traceAllExceptions: false
timeStampFormat: iso8601-utc
verbosity: 1 # This will be inherited by any component with verbosity -1
component:
accessControl:
verbosity: -1 # NOTE: Negative one (-1) means "inherit"
command:
verbosity: 0 # MUST BE ZERO!!! Otherwise, inserted/updated records (all the data) will get logged.
control:
verbosity: -1
geo:
verbosity: 0
index:
verbosity: -1
network:
verbosity: -1
query:
verbosity: -1
replication:
verbosity: -1
sharding:
verbosity: 0
storage:
verbosity: -1
write:
verbosity: 0 # MUST BE ZERO!!! Otherwise, inserted/updated records (all the data) will get logged.
Version and Logs look like this. Please note I typed the data in so any invalid json or typos are due to me not mongo.
Version 3.0.6
TIMESTAMP I WRITE [conn0001] insert project.collection query {<insert our json document here>}
ninserted:1
keyUpdates:0
writeConflicts:0
numYields:0
locks:{Global: {acquireCount: {r: 2, w: 2}}, MMAPV1Journal: {acquireCount: {w:2},aquireWaitCount: {w:2},
timeAquiringMicros: {w: 119326}}, Database: {acquireCount:w: 2}}, Collection" {acquireCount: {W:1}}, oplog: {acquireCount: {w: 1}}} 119ms
TIMESTAMP I COMMAND [conn0001] insert project.$cmd command: insert {<insert our json document here>}
ninserted:1
keyUpdates:0
writeConflicts:0
numYields:0
reslen: 80
locks:{Global: {acquireCount: {r: 2, w: 2}}, MMAPV1Journal: {acquireCount: {w:2},aquireWaitCount: {w:2},
timeAquiringMicros: {w: 119326}
timeAquiringMicros: {w: 119326}}, Database: {acquireCount:w: 2}}, Collection" {acquireCount: {W:1}}, oplog: {acquireCount: {w: 1}}} 119ms