{"id":19556332,"url":"https://github.com/fiverr/node-mongo-slow-log-parse","last_synced_at":"2025-04-26T22:33:00.303Z","repository":{"id":39862686,"uuid":"210791286","full_name":"fiverr/node-mongo-slow-log-parse","owner":"fiverr","description":"Parse MongoDB log lines","archived":false,"fork":false,"pushed_at":"2023-03-21T22:50:34.000Z","size":10,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-04T18:11:36.301Z","etag":null,"topics":["aws","mongodb","parse","slowlog"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mongo-slow-log-parse","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fiverr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-09-25T08:13:44.000Z","updated_at":"2024-12-06T12:19:59.000Z","dependencies_parsed_at":"2023-02-12T23:31:37.571Z","dependency_job_id":null,"html_url":"https://github.com/fiverr/node-mongo-slow-log-parse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fnode-mongo-slow-log-parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fnode-mongo-slow-log-parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fnode-mongo-slow-log-parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fnode-mongo-slow-log-parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fiverr","download_url":"https://codeload.github.com/fiverr/node-mongo-slow-log-parse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251063667,"owners_count":21530837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","mongodb","parse","slowlog"],"created_at":"2024-11-11T04:37:35.895Z","updated_at":"2025-04-26T22:32:55.284Z","avatar_url":"https://github.com/fiverr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongo-slow-log-parse [![](https://circleci.com/gh/fiverr/node-mongo-slow-log-parse.svg?style=svg)](https://circleci.com/gh/fiverr/node-mongo-log-parse) \u003ca href=\"https://www.npmjs.com/package/mongo-slow-log-parse\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/mongo-slow-log-parse.svg\"\u003e\u003c/a\u003e\n\n## 📃 Mongodb Slow Log line parser\n\n```js\nconst parse = require('mongo-slow-log-parse');\n\nconst payload = new Buffer(event.data, 'base64');\nconst logs = JSON.parse(zlib.gunzipSync(payload).toString('ascii'));\n\nconst events = logs.map(parse); // \u003c= ✨ Money time\n```\n\n### Example\n\nRecord\n```\n{\"line\":\"2019-09-24T11:20:44.503+0000 I COMMAND  [conn47945] command db_name.db_collection command: find { find: \\\"db_collection\\\", filter: { user_id: 1199599, full_name: { $nin: [ \\\"\\\", null ] } }, sort: { _id: 1 }, limit: 1, singleBatch: true, $db: \\\"db_name\\\", $clusterTime: { clusterTime: Timestamp(1569324043, 85), signature: { hash: BinData(0, WIERD_HASH123123123AASDA, keyId: 123455677 } }, lsid: { id: UUID(\\\"1111111-222222-333333-444444-555555\\\") } } planSummary: IXSCAN { user_id: 1 } keysExamined:125530 docsExamined:125530 hasSortStage:1 cursorExhausted:1 numYields:990 nreturned:0 reslen:225 locks:{ Global: { acquireCount: { r: 1982 } }, Database: { acquireCount: { r: 991 } }, Collection: { acquireCount: { r: 991 } } } protocol:op_msg 545ms\",\"namespace\":\"db_name.db_collection\"},\n```\n\nResult\n```js\n{\n    timestamp: Date.parse('2019-09-24T11:20:44.503+0000'),\n    severity: 'I',\n    operation: 'COMMAND',\n    connection_id: 'conn47945',\n    db_name: 'db_name',\n    collection_name: 'db_collection',\n    general_command: 'find',\n    mongo_command: '{ find: \\\"db_collection\\\", filter: { user_id: 1199599, full_name: { $nin: [ \\\"\\\", null ] } }, sort: { _id: 1 }, limit: 1, singleBatch: true, $db: \\\"db_name\\\", $clusterTime: { clusterTime: Timestamp(1569324043, 85), signature: { hash: BinData(0, WIERD_HASH123123123AASDA), keyId: 123455677 } }, lsid: { id: UUID(\\\"1111111-222222-333333-444444-555555\\\") } } planSummary: IXSCAN { user_id: 1 } keysExamined:125530 docsExamined:125530 hasSortStage:1 cursorExhausted:1 numYields:990 nreturned:0 reslen:225 locks:{ Global: { acquireCount: { r: 1982 } }, Database: { acquireCount: { r: 991 } }, Collection: { acquireCount: { r: 991 } } }',\n    took_millis: 545,\n    num_returned: 0,\n    num_yields: 990,\n    result_length: 225,\n    keys_examined: 125530,\n    docs_examined: 125530,\n    protocol: 'op_msg'\n}\n```\n\n### Related projects:\n- [RDS Slow Log line parser](https://github.com/fiverr/node-rds-slow-log-parse)\n- [ElasticSearch Slow Log line parser](https://github.com/fiverr/node-es-slow-log-parse)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiverr%2Fnode-mongo-slow-log-parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiverr%2Fnode-mongo-slow-log-parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiverr%2Fnode-mongo-slow-log-parse/lists"}