{"_id":"mongodb-log","_rev":"141-21896758ac5fe4e42c765ee7cce9ede0","name":"mongodb-log","dist-tags":{"latest":"1.2.5"},"versions":{"0.1.0":{"name":"mongodb-log","version":"0.1.0","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@0.1.0","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"063c1efb1d18f861e97c86fe3339499d131eadb7","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-0.1.0.tgz","integrity":"sha512-pdoDDWPvGawjp1FPTaCtbC8VbeyQsQ59+/Ny8ORoPCDX9Jt66jvUjZZy9szOCpg9p5XlTfvWGMnXoKDHOG4Idw==","signatures":[{"sig":"MEYCIQCUGwNgGD2Ri3myKCXZ+RbQ8NZDPo3H26AzU5Zgu1oxeQIhAL8g5TAQfXpQN7b5OYf6qDCh35eZVJ6BRolt4zgzd+++","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"test":"mocha"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.3","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"debug":"^0.7.4","regret":"^0.1.1"},"devDependencies":{"mocha":"^1.17.1"}},"1.0.0":{"name":"mongodb-log","version":"1.0.0","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.0.0","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"c438aa2781c5ccfe7b9509a6a1008d810eb7b1fe","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.0.0.tgz","integrity":"sha512-s9H0gnZaz0JcH0I2lceB6iKCuNEkm6N2BPeZCqWK1OoRqu6P3kQVAFNnSH6J9HGE4N/w2eqWDkXz7P51q+ORug==","signatures":[{"sig":"MEQCIFgRgCAg6In5fpL6qbJxixrvmX5uvoQFbBtPPeCrzUAHAiB9YZ6aFNBHfUCOdk9i6dk5SJIe66XRijnb4FchHSc+Fg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"c438aa2781c5ccfe7b9509a6a1008d810eb7b1fe","scripts":{"test":"mocha","check":"jshint *.js && istanbul cover _mocha"},"_npmUser":{"name":"wz3chen","email":"waleycz@gmail.com"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.9","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"set":"^1.1.1","debug":"^0.7.4","regret":"^0.1.1"},"devDependencies":{"mocha":"^1.17.1","jshint":"^2.5.1","istanbul":"^0.2.10"}},"1.1.1":{"name":"mongodb-log","version":"1.1.1","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.1.1","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"e7830ee22e3cde33738329c9791bcae91748841e","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.1.1.tgz","integrity":"sha512-1ittejF5pay9+prVBXNov6n7yRA59DcwxIxWWsgll5obejw6/L62eqLlF+Emi9KMR4z+vparf4VTneMyJIH5Bw==","signatures":[{"sig":"MEYCIQDTYPSrpZ/TgumEYJGCMGGbGFgbUMh1vIfP6zXYVULW/AIhAJH1jonpBK/LDOVAYJ10IEzxBNtKoBByMNdqPAWh+fBK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"e7830ee22e3cde33738329c9791bcae91748841e","scripts":{"test":"mocha","check":"jshint *.js && istanbul cover _mocha"},"_npmUser":{"name":"wz3chen","email":"waleycz@gmail.com"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.9","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"set":"^1.1.1","debug":"^0.7.4","regret":"^0.1.1"},"devDependencies":{"mocha":"^1.17.1","jshint":"^2.5.1","istanbul":"^0.2.10"}},"1.2.0":{"name":"mongodb-log","version":"1.2.0","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.2.0","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"2618eb9f2871832aac012c3d549d0d0603693e6d","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.2.0.tgz","integrity":"sha512-glpF91695ymYqwwsbrHnU0KTRGUtzCTbIGaajotDvh46U6CSy4SsfPxawKgm4JoqjkIWcOU+32nloDhlb9QIPA==","signatures":[{"sig":"MEYCIQCdaOkB0Nwnp2BiLdIIGcRgH1OAWTnLyGzZOHc9ZdW92wIhAPhVesSg89XbJI8ErssvomPtVVMn1yHUvc6uRiGo1QG9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"2618eb9f2871832aac012c3d549d0d0603693e6d","gitHead":"295cf5f6b43f5d3743aa29f410678b5d86f56111","scripts":{"test":"mocha"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.16","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"debug":"^1.0.4","regret":"^0.1.1"},"devDependencies":{"mocha":"^1.20.1"}},"1.2.1":{"name":"mongodb-log","version":"1.2.1","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.2.1","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"88674a4a1417257cae3ac927be7b280277157ba3","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.2.1.tgz","integrity":"sha512-mPT3FW0zKOhhZwDbc6XTRyEAatkM8pKQyN1F4w5ADYdujZ2P6aHkn1mQ7SKjnTd6O1uwn5EpLtrHfUAPT5eGvQ==","signatures":[{"sig":"MEQCIEv0rMrTNz7hwaNgJEAEdFdm6tUSFY++bGdSJ1YObZfYAiB51+VkCKvB00Oe9oACkoLlmhaIjXg4r7YYvyN98rAelg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"88674a4a1417257cae3ac927be7b280277157ba3","gitHead":"73981e3fdbee50fc2c0604f420e7f02f237c3798","scripts":{"test":"mocha"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.16","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"debug":"^1.0.4","regret":"^0.1.1"},"devDependencies":{"mocha":"^1.20.1"}},"1.2.2":{"name":"mongodb-log","version":"1.2.2","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.2.2","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"eb0e80fdfd095eefb35c7f4a704219c46a50a988","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.2.2.tgz","integrity":"sha512-/Ke890c1a5Uhdn/UR9v7rvRki3p4COuy8kOhfDPLjAup7q0km3+LF2zLhVsC1EhwFsP8diKDaLFox4NuSeidLw==","signatures":[{"sig":"MEUCIQC1hD6VMxD71r1p55zt3sXLsG0MhajO6hDiG7QRNs3HWgIgJWQNyMzNwc/bORWgx4pQlfQf8kzhVRe20wZxyG2zn0w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"eb0e80fdfd095eefb35c7f4a704219c46a50a988","scripts":{"test":"mocha"},"_npmUser":{"name":"wz3chen","email":"waleycz@gmail.com"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.9","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"debug":"^1.0.4","regret":"^0.1.1","json-literal":"^1.1.0"},"devDependencies":{"mocha":"^1.20.1"}},"1.2.3":{"name":"mongodb-log","version":"1.2.3","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.2.3","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"96d1ca3b657931c70e74eb0e6bdd168a2fb16d48","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.2.3.tgz","integrity":"sha512-lXzxdMuK6VOfD0fU8nM8owffQV+pncP76x/Lo/ByiXtPCNXVoryB437ajLMGlds9rPr2sAlIoAt1m4P6Pvfzfw==","signatures":[{"sig":"MEUCIQCg8EBpdcXp6mtcz0De3tAqRwJNnf6Cn7crjcAieFGTAAIgPaYKX+xC/rkxoNkScj4NBSdWnl+ZZE8TxVgajmejtts=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"96d1ca3b657931c70e74eb0e6bdd168a2fb16d48","scripts":{"test":"mocha"},"_npmUser":{"name":"wz3chen","email":"waleycz@gmail.com"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.9","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"debug":"^1.0.4","regret":"^0.1.1","json-literal":"^1.1.0"},"devDependencies":{"mocha":"^1.20.1"}},"1.2.4":{"name":"mongodb-log","version":"1.2.4","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.2.4","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"885d5efc1ad276db7b8b8734658df2d6729966c1","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.2.4.tgz","integrity":"sha512-X7nokDrvnV0ufrITm7MDTWViuEoO0ZJM0Jh/2tYMDZFHT1Hohnd2Q3R6WQ6CeBD2UH6Xiol+dN+rO5rMLx2OEw==","signatures":[{"sig":"MEUCIDhk+hoiIgG0CBvDyfb2FIxxvuvDoDPi7MIPiUGRkMhXAiEAtSPU1BUJHkUX/JNDCUpw87cbXLMTHbIXUPiirrfFxEQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"885d5efc1ad276db7b8b8734658df2d6729966c1","gitHead":"714d82e31d29cd3fa6fa0ddf9a4499f5475a4b7f","scripts":{"test":"mocha"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"1.4.26","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"dependencies":{"debug":"^1.0.4","regret":"^0.1.1","json-literal":"^1.1.0"},"devDependencies":{"mocha":"^1.20.1"}},"1.2.5":{"name":"mongodb-log","version":"1.2.5","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-log@1.2.5","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"},{"name":"wz3chen","email":"waleycz@gmail.com"},{"name":"rueckstiess","email":"thomas@rueckstiess.net"}],"homepage":"http://github.com/imlucas/mongodb-log","bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"dist":{"shasum":"bf3e036520748be07f31904dc77a1398a3785563","tarball":"https://registry.npmjs.org/mongodb-log/-/mongodb-log-1.2.5.tgz","integrity":"sha512-nH5ElU+EmecMNc404SQh/xsOxnbFtb4HS+4YOli/BWKBE78RjvKucts4LcMCEBNQ8jYsA73nfsQKcwQeN1+uJg==","signatures":[{"sig":"MEUCIQDNGSN2LVIGMZBd+aQ7lNVgGS5RzV1Gnf4/w34xIjyuyAIga5ieHg2XOKa6U8NMFgSYzAHYzd4f1o3Piy2TjcI42b4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"bf3e036520748be07f31904dc77a1398a3785563","gitHead":"85aa1d803c49708c18708bc49d26dc545477b82a","scripts":{"test":"mocha"},"_npmUser":{"name":"rueckstiess","email":"thomas@rueckstiess.net"},"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"_npmVersion":"2.1.3","description":"Turn flat mongodb log entires into nice structured objects.","directories":{},"_nodeVersion":"0.10.30","dependencies":{"debug":"^1.0.4","regret":"^0.1.1","json-literal":"^1.1.0","mongodb-log2ejson":"^0.1.2"},"devDependencies":{"mocha":"^1.20.1"}}},"time":{"created":"2014-05-16T15:05:35.297Z","modified":"2026-07-15T15:36:13.349Z","0.1.0":"2014-05-16T15:05:35.297Z","1.0.0":"2014-06-19T17:34:52.131Z","1.1.1":"2014-07-15T03:06:14.736Z","1.2.0":"2014-07-18T19:34:52.154Z","1.2.1":"2014-07-18T19:48:17.897Z","1.2.2":"2014-07-25T17:13:59.466Z","1.2.3":"2014-08-14T12:37:24.849Z","1.2.4":"2014-09-09T17:41:57.899Z","1.2.5":"2014-12-22T03:16:47.360Z"},"bugs":{"url":"https://github.com/imlucas/mongodb-log/issues"},"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","homepage":"http://github.com/imlucas/mongodb-log","keywords":["mongodb","mongodb.js"],"repository":{"url":"http://github.com/imlucas/mongodb-log.git","type":"git"},"description":"Turn flat mongodb log entires into nice structured objects.","maintainers":[{"email":"satya@mongodb.com","name":"satyasinha"},{"email":"kristina.stefanova@mongodb.com","name":"kristina.stefano"},{"email":"nathan.smyth@10gen.com","name":"jarjee"},{"email":"iteng@mongodb.com","name":"devtoolsbot"},{"email":"james.wang@mongodb.com","name":"mongo-j"},{"email":"neal.beeken@mongodb.com","name":"nbbeeken"},{"email":"dbx-node@mongodb.com","name":"dbx-node"},{"email":"devtools-npm-user@mongodb.com","name":"devtools-npm-user"},{"email":"waleycz@gmail.com","name":"wz3chen"},{"email":"hrabovsky.lucas@gmail.com","name":"imlucas"},{"email":"me@tomr.au","name":"rueckstiess"},{"email":"dana.groff+mongodb-js@mongodb.com","name":"mongodb-js-user"}],"readme":"# mongodb-log\n\n[![build status](https://secure.travis-ci.org/imlucas/mongodb-log.png)](http://travis-ci.org/imlucas/mongodb-log)\n\nTurn mongod log entries to nice objects that are easy to work with.\n\n## Example\n\n```javascript\nvar parseLog = require('mongodb-log').parse,\n  line = 'Wed Mar 12 14:42:31 [initandlisten] db version v2.5.6-pre-';\n\nconsole.log('`' +line + '` → ', parseLog(line));\n\nvar lines = [\n  '2014-05-16T10:39:00.938-0400 [conn611] end connection 127.0.0.1:57499 (22 connections now open)',\n  '2014-05-16T10:43:24.840-0400 [clientcursormon] mem (MB) res:9 virt:3514',\n  '2014-05-16T10:43:24.840-0400 [clientcursormon]  mapped (incl journal view):960',\n  '2014-05-16T10:43:24.840-0400 [clientcursormon]  connections:22',\n  '2014-05-16T10:48:24.926-0400 [clientcursormon] mem (MB) res:9 virt:3514',\n  '2014-05-16T10:48:24.926-0400 [clientcursormon]  mapped (incl journal view):960',\n  '2014-05-16T10:48:24.926-0400 [clientcursormon]  connections:22'\n];\n\nconsole.log('lots of lines → ', parseLog(lines));\n\nconsole.log('i even understand events! → ', parseLog([\n  '2014-05-16T10:50:13.450-0400 [initandlisten] recover : no journal files present, no recovery needed',\n  '2014-05-16T10:50:13.579-0400 [initandlisten] waiting for connections on port 27017'\n]));\n\n```\n\nwill output\n\n```\n`Wed Mar 12 14:42:31 [initandlisten] db version v2.5.6-pre-` →  [\n  {\n    name: 'initandlisten',\n    message: 'db version v2.5.6-pre-',\n    date: 'Wed Mar 12 14:42:31',\n    event: null\n  }\n]\n\nlots of lines →  [\n  { name: 'conn611',\n    message: 'end connection 127.0.0.1:57499 (22 connections now open)',\n    date: '2014-05-16T10:39:00.938-0400',\n    event: null },\n  { name: 'clientcursormon',\n    message: 'mem (MB) res:9 virt:3514',\n    date: '2014-05-16T10:43:24.840-0400',\n    event: null },\n  { name: 'clientcursormon',\n    message: ' mapped (incl journal view):960',\n    date: '2014-05-16T10:43:24.840-0400',\n    event: null },\n  { name: 'clientcursormon',\n    message: ' connections:22',\n    date: '2014-05-16T10:43:24.840-0400',\n    event: null },\n  { name: 'clientcursormon',\n    message: 'mem (MB) res:9 virt:3514',\n    date: '2014-05-16T10:48:24.926-0400',\n    event: null },\n  { name: 'clientcursormon',\n    message: ' mapped (incl journal view):960',\n    date: '2014-05-16T10:48:24.926-0400',\n    event: null },\n  { name: 'clientcursormon',\n    message: ' connections:22',\n    date: '2014-05-16T10:48:24.926-0400',\n    event: null }\n]\n\ni even understand events! →  [\n  { name: 'initandlisten',\n    message: 'recover : no journal files present, no recovery needed',\n    date: '2014-05-16T10:50:13.450-0400',\n    event: null },\n  { name: 'initandlisten',\n    message: 'waiting for connections on port 27017',\n    date: '2014-05-16T10:50:13.579-0400',\n    event: { name: 'ready', data: {port: 27017} } }\n]\n```\n\n## license\n\nMIT\n\n## MongoDB Log Format In-Depth\n\n### Elements to extract from log files\n\n#### General\n\nAll log lines have these general values.\n\n##### Timestamps\n\nThere are 4 datetime formats that need to be supported.\n\n| Datetime Format |            Example             | MongoDB Version |\n| --------------- | ------------------------------ | --------------- |\n| ctime           | `Wed Dec 31 19:00:00.000`      | 2.4             |\n| ctime-pre2.4    | `Wed Dec 31 19:00:00`          | < 2.4           |\n| iso8601-local   | `1969-12-31T19:00:00.000+0500` | 2.6             |\n| iso8601-utc     | `1970-01-01T00:00:00.000Z`     | 2.6             |\n\nThey are at the beginning of a log line. The regex capture groups to be\nextracted are:\n\n- `timestamp`\n- `timestamp_format`\n\n\n##### Threads / Connections\n\nThe `thread` is listed in square brackets after the timestamp. The example\nbelow shows two lines with threads `conn611` and `initandlisten`.\n\n```\n2014-05-16T10:39:00.938-0400 [conn611] end connection 127.0.0.1:57499 (22\nconnections now open)\n2014-05-16T10:50:13.450-0400 [initandlisten] recover : no journal files present,\n no recovery needed\n```\n\nThe regex capture group is `thread`.\n\nEach connection is its own thread, for example `conn611` above. While\neverything happening on that connection (including its end, see example above)\nhas the correct thread name, the opening of the connection is handled by the\n`initandlisten` thread (in mongod) and the `mongosMain` thread (in mongos).\nIt's often interesting to know when a certain connection was opened.\nTherefore, a second regex capture named `conn` is exposed, that returns the\nconnection name even for the \"connection accepted\" log line. The connection\nname can be extracted from the `#<number>` value after the IP address and\nport.\n\nExample:\n\n```\n2014-05-31T14:21:14.734-0400 [initandlisten] connection accepted from\n127.0.0.1:51786 #14 (3 connections now open)\n2014-05-31T14:21:14.734-0400 [conn14] command admin.$cmd command: isMaster\n{ ismaster: 1 } keyUpdates:0 numYields:0  reslen:371 0ms\n2014-05-31T14:21:14.735-0400 [conn14] end connection 127.0.0.1:51786 (2\nconnections now open)\n```\n\n| line ## |    `thread`   | `conn` |\n| ------ | ------------- | ------ |\n|      1 | initandlisten | conn14 |\n|      2 | conn14        | conn14 |\n|      3 | conn14        | conn14 |\n\n#### Operations\n\nSome log lines are \"operations\" (query, getmore, update, delete, command).\nThese do not match up with the `OP_*` opcodes of the wire protocol (e.g.\ncommands are queries on a special `.$cmd` collection), but should be seen as\n\"logical\" operations. Operations have a type (query, getmore, update, delete,\ncommand), a namespace on which the operation is executed and a duration in\nmilliseconds.\n\nnamespace format:\nnamespace = {{ database name }}.{{ collection name }}\n- database names cannot have a \".\"\n- anything after the first \".\" is the collection name\n  - the collection name also includes the index name\n    - index name being of ${{ index name }}\n  e.g. admin.system.system1.system.$index\n    database   = \"admin\",\n    collection = \"system.system1.system2.$index\",\n    index = \"index\"\n\nThe exposed regex capture groups are `operation`, `namespace`, `database`,\n`collection`, `duration` and `index`.\n\nSome other events do not follow the operations pattern but still have a\nduration that is useful to extract, for example:\n\n```\nTue Jan 28 21:46:14.886 [DataFileSync] flushing mmaps took 10973ms  for 21\nfiles\n```\n\nThe `duration` of these lines should also be extracted (here 10973\nmilliseconds) and exposed via the `duration` name.\n\n\n##### Queries, Updates, Deletes\n\nQuery operations, as well as updates and deletes, have a `query` part to match\na subset of documents. Example:\n\n```\n2014-05-31T14:20:56.002-0400 [conn16] query test.coll query: { query: { foo:\n\"value\", bar: \"another value\" }, orderby: { number: -1.0 } } planSummary: EOF\nntoreturn:0 ntoskip:0 keyUpdates:0 numYields:0 locks(micros) r:106 nreturned:0\nreslen:20 12ms\n```\n\nThe query here is `{ foo: \"value\", bar: \"another value\" }`. The query shape of\nthis query is `{ foo: 1, bar: 1}`. The sort shape is `{ number: -1.0 }` (sorts\nare always represented as shape, with only 1 or -1 as valid values).\n\nThe regex capture groups to extract are `query` (full query with values),\n`query_shape`, `sort_shape`.\n\n\n##### Operation Stats\n\nSome operations (mostly CRUD operations) return values for the following\ncounters, which should be exposed as well:\n\n*  `nscanned`\n*  `ntoreturn`\n*  `ntoskip`\n*  `nupdated`\n*  `nreturned`\n*  `ninserted`\n*  `ndeleted`\n*  `nmoved`\n*  `numYields`\n\n##### Locks\n\nSome operations require to take read/write locks. These lock times are\nmeasured in microseconds. They follow this pattern (an operation either prints\nread `r` or write `w` lock times, but not both).\n\n```\nlocks(micros) r:106\n```\n\nIn this case, the read lock was held for 106 microseconds.\n\nThe regex capture groups are `r` and `w`.\n\n\n#### Events\n\nMongoDB logs a large number of unstructured event lines, that follow the\nsimple pattern\n```\n{{timestamp}} [{{thread}}] {{description}}\n```\n\nSome of these events are generally more useful for issue diagnosis and should\nbe extracted, for example\n\n* Start and termination of the server\n* Index builds (start, progress, end)\n* ...\n\nEvents have an event name (for example \"ready\", \"index\", ...) and optionally\nsome data specific to the event. They are returned as a document of the form\n`{\"name\": \"index\", \"data\": { ... }`.\n\n### Full list of names to extract\n\n- [x] `R`\n- [x] `W`\n- [x] `timestamp`\n- [x] `timestamp_format`\n- [x] `thread`\n- [x] `conn`\n- [x] `operation`\n- [x] `namespace`\n- [x] `database`\n- [x] `collection`\n- [x] `duration`\n- [x] `query`\n- [ ] `query_shape`\n- [x] `sort_shape`\n- [x] `index`\n- [x] `nscanned`\n- [x] `ntoreturn`\n- [x] `ntoskip`\n- [x] `nupdated`\n- [x] `nreturned`\n- [x] `ninserted`\n- [x] `ndeleted`\n- [x] `nmoved`\n- [x] `numYields`\n- [x] `r`\n- [x] `w`\n- [ ] `event`\n","readmeFilename":"README.md"}