Can anyone explain to me about the logs in mongodb like what each variable in logs are defined for and what they mean?
2015-02-26T16:05:24.112+0100 [conn1359] command xxx.$cmd command: { fsync: false, j: false, w: 1 } } keyUpdates:0 numYields:0 reslen:55 4045ms
2015-02-26T16:05:24.114+0100 [conn1296] update xxx.users query: nscanned:2015 nscannedObjects:2015 nMatched:1 nModified:1 fastmod:1 keyUpdates:0 numYields:15 locks(micros) w:7292 4538ms
As part of normal operation, MongoDB maintains a running log of events, including entries such as incoming connections, commands run, and issues encountered. Generally, log messages are useful for diagnosing issues, monitoring your deployment, and tuning performance.
reslen is the query result length in bytes.
MongoDB logs can be found in the MongoDB log files at /var/log/mongodb/mongodb. log. If you can't find the log files from this location, you can check the mongodb. conf.
You can also trigger log rotation using MongoDB's logrotate administrative command, which might be useful as a first step to allow you to compress or archive your current large log file. I wouldn't outright delete recent log files until you are certain you won't need them for any diagnostic purposes.
Let's take a look at the latest format for MongoDB errors which you can find by looking at your MongoDB log file which is commonly located at /var/log/mongodb/mongodb. log . If the file's not there, you'll need to find your mongodb. conf file which specifies where your log file lives.
You need to refer to the Database Profiler Output section of the MongoDB documentation to get a detailed explanation of the query profile information like read and write operations, cursor operations, and database commands that MongoDB writes to the log. To answer your question
fsync: - Forces the mongod process to flush all pending writes from the storage layer to disk.
keyUpdates: - The number of index keys the update changed in the operation. Changing an index key carries a small performance cost because the database must remove the old key and inserts a new key into the B-tree index.
numYield: - The number of times the operation yielded to allow other operations to complete. Typically, operations yield when they need access to data that MongoDB has not yet fully read into memory. This allows other operations that have data in memory to complete while MongoDB reads in data for the yielding operation.
responseLength (reslen): - The length in bytes of the operation’s result document. A large responseLength can affect performance.
nscanned: - The number of documents that MongoDB scans in the index in order to carry out the operation. In general, if nscanned is much higher than nreturned, the database is scanning many objects to find the target objects. Consider creating an index to improve this.
nMatched: - The number of documents selected for update. If the update operation results in no change to the document, e.g. $set expression updates the value to the current value, nMatched can be greater than nModified.
nModified: - The number of existing documents updated. If the update/replacement operation results in no change to the document, such as setting the value of the field to its current value, nModified can be less than nMatched.
lockStats locks(micros): - The time in microseconds the operation spent acquiring and holding locks. This field reports data for the following lock types:
R - global read lock
W - global write lock
r - database-specific read lock
w - database-specific write lock
timeLockedMicros: - The time in microseconds the operation held a specific lock. For operations that require more than one lock, like those that lock the local database to update the oplog, this value may be longer than the total length of the operation (i.e. millis.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With