我们在带有 Linux AMI 的 AWS 环境中使用 mongodb 版本 3。
最初 mongo 正在记录整个文档。然后我们降低了 yaml 中的详细程度。这似乎使大多数(99%)的文件没有被记录下来。但是我们仍然发现它偶尔仍然会记录记录。它似乎先做一个 WRITE 然后是一个 COMMAND 并且都包含整个记录。
有没有办法确保文档永远不会被写入日志,同时仍然有有用的日志记录?
谢谢
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.
版本和日志看起来像这样。请注意,我输入了数据,因此任何无效的 json 或拼写错误都是由于我而不是 mongo 造成的。
版本 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