mdbkit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mdbkit-0.1.0/LICENSE +21 -0
- mdbkit-0.1.0/PKG-INFO +207 -0
- mdbkit-0.1.0/README.md +183 -0
- mdbkit-0.1.0/mdbkit/__init__.py +3 -0
- mdbkit-0.1.0/mdbkit/advisor.py +302 -0
- mdbkit-0.1.0/mdbkit/analysis.py +436 -0
- mdbkit-0.1.0/mdbkit/cli.py +256 -0
- mdbkit-0.1.0/mdbkit/explain.py +244 -0
- mdbkit-0.1.0/mdbkit/filtering.py +55 -0
- mdbkit-0.1.0/mdbkit/parser.py +149 -0
- mdbkit-0.1.0/mdbkit/render.py +141 -0
- mdbkit-0.1.0/mdbkit/scripts.py +69 -0
- mdbkit-0.1.0/mdbkit/triage.py +360 -0
- mdbkit-0.1.0/mdbkit.egg-info/PKG-INFO +207 -0
- mdbkit-0.1.0/mdbkit.egg-info/SOURCES.txt +22 -0
- mdbkit-0.1.0/mdbkit.egg-info/dependency_links.txt +1 -0
- mdbkit-0.1.0/mdbkit.egg-info/entry_points.txt +2 -0
- mdbkit-0.1.0/mdbkit.egg-info/requires.txt +3 -0
- mdbkit-0.1.0/mdbkit.egg-info/top_level.txt +1 -0
- mdbkit-0.1.0/pyproject.toml +40 -0
- mdbkit-0.1.0/setup.cfg +4 -0
- mdbkit-0.1.0/tests/test_explain.py +91 -0
- mdbkit-0.1.0/tests/test_mdbkit.py +215 -0
- mdbkit-0.1.0/tests/test_triage.py +120 -0
mdbkit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Saqib Ameen Subhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
mdbkit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mdbkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Offline toolkit for MongoDB 4.4+ structured logs: log analysis, slow-query shapes, connection churn, and deterministic index advice. A spiritual successor to mtools' log tools.
|
|
5
|
+
Author: Saqib Ameen Subhan
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/saqibameen86/mdbkit
|
|
8
|
+
Project-URL: Issues, https://github.com/saqibameen86/mdbkit/issues
|
|
9
|
+
Keywords: mongodb,logs,logv2,mtools,index,dba,slow-query
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Database
|
|
17
|
+
Classifier: Topic :: System :: Systems Administration
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# mdbkit
|
|
26
|
+
|
|
27
|
+
**An offline toolkit for MongoDB structured logs — log analysis, slow-query shapes, connection churn, and deterministic index advice.**
|
|
28
|
+
|
|
29
|
+
A spiritual successor to [mtools](https://github.com/rueckstiess/mtools)' log tools (`mloginfo`, `mlogfilter`) for the structured JSON log format MongoDB has used since 4.4 — the format mtools never supported. Built for DBAs and ops engineers running self-managed MongoDB 4.4 / 5.0 / 6.0 / 7.0 / 8.0.
|
|
30
|
+
|
|
31
|
+
> **Privacy by design: mdbkit never makes a network call.** It reads log files (or stdin) and writes to stdout. No telemetry, no phoning home, no cloud. Your logs never leave your machine. It is safe to run on air-gapped database hosts.
|
|
32
|
+
|
|
33
|
+
## Why
|
|
34
|
+
|
|
35
|
+
MongoDB 4.4 switched to structured JSON logging, and the beloved mtools log commands stopped working — the issue has been open since 2020. Meanwhile, index recommendations from MongoDB's Performance Advisor require a paid Atlas tier or Cloud/Ops Manager. If you run Community Edition on your own infrastructure, you're back to reading raw JSON logs with `grep` and `jq`.
|
|
36
|
+
|
|
37
|
+
mdbkit fills that gap: a single, dependency-free CLI that turns structured logs into answers.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pipx install mdbkit # recommended
|
|
43
|
+
# or
|
|
44
|
+
pip install mdbkit
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Zero runtime dependencies (pure Python stdlib), so it also installs cleanly on air-gapped hosts from a single wheel:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip download mdbkit -d ./wheels # on a connected machine
|
|
51
|
+
pip install --no-index --find-links ./wheels mdbkit # on the DB host
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Requires Python 3.9+.
|
|
55
|
+
|
|
56
|
+
## Quick start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Overall log summary: versions, restarts, connection counts, error/warning totals
|
|
60
|
+
mdbkit loginfo /var/log/mongodb/mongod.log
|
|
61
|
+
|
|
62
|
+
# Slow queries grouped by query shape (literals stripped), ranked by total time
|
|
63
|
+
mdbkit queries mongod.log
|
|
64
|
+
mdbkit queries mongod.log --sort scanRatio --limit 10 --json
|
|
65
|
+
|
|
66
|
+
# Connection churn by source IP, appName, and driver
|
|
67
|
+
mdbkit connections mongod.log
|
|
68
|
+
|
|
69
|
+
# Filter raw log lines (output stays valid logv2 JSON — chainable)
|
|
70
|
+
mdbkit filter mongod.log --slow 500 --component COMMAND --ns shop.orders
|
|
71
|
+
mdbkit filter mongod.log --from 2026-07-01T08:00:00Z --to 2026-07-01T09:00:00Z | mdbkit queries -
|
|
72
|
+
|
|
73
|
+
# Rotated/compressed logs work directly
|
|
74
|
+
mdbkit queries mongod.log.2.gz
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Index advice
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mdbkit advise mongod.log
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Produces **candidate** indexes from observed slow-query shapes using the ESR
|
|
84
|
+
(Equality → Sort → Range) guideline, with evidence, confidence, caveats, and a
|
|
85
|
+
validation step for every recommendation:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
[1] shop.orders — confidence: HIGH
|
|
89
|
+
query shape : {createdAt:gt, status:eq} sort:{createdAt:-1}
|
|
90
|
+
candidate : { status: 1, createdAt: -1 }
|
|
91
|
+
evidence : COLLSCAN observed in planSummary
|
|
92
|
+
evidence : in-memory sort (hasSortStage) observed
|
|
93
|
+
evidence : examined 251,400 docs to return 73 (3444:1)
|
|
94
|
+
caveat : Every index adds write and storage overhead ...
|
|
95
|
+
validate : Re-run the query with .explain('executionStats') ...
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The advice gets sharper if you export your existing indexes and a sampled
|
|
99
|
+
schema. mdbkit never connects to your database — instead it prints small
|
|
100
|
+
`mongosh` scripts you run yourself, so you can read exactly what they do:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
mdbkit export-script indexes > export_indexes.js
|
|
104
|
+
mdbkit export-script schema > export_schema.js
|
|
105
|
+
mongosh --quiet "mongodb://localhost/shop" export_indexes.js > indexes.json
|
|
106
|
+
mongosh --quiet "mongodb://localhost/shop" export_schema.js > schema.json
|
|
107
|
+
|
|
108
|
+
mdbkit advise mongod.log --indexes indexes.json --schema schema.json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
With `--indexes`, mdbkit checks each candidate against your existing indexes
|
|
112
|
+
(flagging when an existing index should already cover the query, or when a
|
|
113
|
+
candidate would make an existing index redundant — it flags, never suggests
|
|
114
|
+
dropping). With `--schema`, it warns about multikey (array) fields,
|
|
115
|
+
low-cardinality fields, and field-name typos. The schema export records field
|
|
116
|
+
**names and types only — no values.**
|
|
117
|
+
|
|
118
|
+
### Incident triage (beta)
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mdbkit triage /var/log/mongodb/mongod.log # or a copied log + --no-sysprobe
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
One command during an incident: election/stepdown timeline, connection
|
|
125
|
+
storms, hot collections, error clusters, slow checkpoints — plus local
|
|
126
|
+
disk/memory/load probes when run on the DB host. Read-only: it never
|
|
127
|
+
connects to the database, and every finding ends with a next step for a
|
|
128
|
+
human to review. Detectors marked beta are validated against real logs
|
|
129
|
+
where available and clearly labeled where broader validation is pending.
|
|
130
|
+
|
|
131
|
+
### Explain-plan analysis
|
|
132
|
+
|
|
133
|
+
Got a slow query in hand rather than a log? Save its explain output and ask
|
|
134
|
+
mdbkit what's wrong:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# in mongosh: EJSON.stringify(db.orders.find({...}).sort({...}).explain("executionStats"))
|
|
138
|
+
mdbkit explain explain.json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
You get the plan chain (`SORT -> COLLSCAN`), the examined/returned math, plain-
|
|
142
|
+
English verdicts (full collection scan, blocking in-memory sort, weakly
|
|
143
|
+
selective index, covered query), and — when the plan needs help — the same
|
|
144
|
+
evidence-backed candidate index the advisor would produce. Works with find and
|
|
145
|
+
aggregate explains, classic and SBE (6.0+) plans, and sharded winning plans.
|
|
146
|
+
|
|
147
|
+
### Design principles
|
|
148
|
+
|
|
149
|
+
* **Deterministic.** Same log in, same advice out. Rules, not AI. Every
|
|
150
|
+
recommendation shows its evidence and its rule of reasoning.
|
|
151
|
+
* **Candidates, not commands.** mdbkit never tells you to blindly run
|
|
152
|
+
`createIndex`, and never advises dropping an index.
|
|
153
|
+
* **Honest about uncertainty.** Shapes seen once are labeled low-confidence;
|
|
154
|
+
`$or`, `$regex`, `$in` and low-selectivity operators carry explicit caveats.
|
|
155
|
+
* **Offline, always.** No network code exists in this codebase.
|
|
156
|
+
|
|
157
|
+
## What it reads
|
|
158
|
+
|
|
159
|
+
Any MongoDB 4.4+ structured log: `mongod.log`, `mongos` logs, rotated `.gz`
|
|
160
|
+
files, or stdin (`-`). Slow-query lines (`"msg":"Slow query"`) are logged by
|
|
161
|
+
default for operations over `slowms` (100 ms); lower `slowms` or enable
|
|
162
|
+
profiling level 1 to capture more:
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
db.setProfilingLevel(1, { slowms: 50 })
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Pre-4.4 plain-text logs are detected and politely refused — for those, the
|
|
169
|
+
original mtools still works.
|
|
170
|
+
|
|
171
|
+
## Roadmap
|
|
172
|
+
|
|
173
|
+
Terminal output is and will remain first-class — this tool is built for the
|
|
174
|
+
Linux box the database actually runs on.
|
|
175
|
+
|
|
176
|
+
* **v0.2** — FTDC (`diagnostic.data`) decoding: offline summaries of the
|
|
177
|
+
metrics MongoDB already records on every node; election/failover timeline
|
|
178
|
+
from REPL events; per-shape drill-down.
|
|
179
|
+
* **v0.3** — shareable Markdown/HTML report export (for tickets and
|
|
180
|
+
post-incident reviews — a convenience layer, never a replacement for the
|
|
181
|
+
terminal).
|
|
182
|
+
|
|
183
|
+
mdbkit is validated against real-world structured logs (tens of thousands of
|
|
184
|
+
lines) in addition to its synthetic test fixtures.
|
|
185
|
+
|
|
186
|
+
## Bugs, feature requests, questions
|
|
187
|
+
|
|
188
|
+
Please use [GitHub Issues](../../issues) — it keeps problems and fixes public
|
|
189
|
+
so the next person can find them. Real-world log lines that parse wrongly are
|
|
190
|
+
the most valuable bug reports of all (redact literals first!).
|
|
191
|
+
|
|
192
|
+
## Security
|
|
193
|
+
|
|
194
|
+
mdbkit is offline by design: the codebase contains no network code, never
|
|
195
|
+
executes or evaluates input, and treats every log line as untrusted data
|
|
196
|
+
(strict JSON parsing only — shell constructors are never evaluated). See
|
|
197
|
+
[SECURITY.md](SECURITY.md) for the reporting process.
|
|
198
|
+
|
|
199
|
+
## Non-affiliation
|
|
200
|
+
|
|
201
|
+
mdbkit is an independent community project. It is **not affiliated with,
|
|
202
|
+
endorsed by, or sponsored by MongoDB, Inc.** "MongoDB" is a registered
|
|
203
|
+
trademark of MongoDB, Inc., used here only to describe compatibility.
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT — see [LICENSE](LICENSE).
|
mdbkit-0.1.0/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# mdbkit
|
|
2
|
+
|
|
3
|
+
**An offline toolkit for MongoDB structured logs — log analysis, slow-query shapes, connection churn, and deterministic index advice.**
|
|
4
|
+
|
|
5
|
+
A spiritual successor to [mtools](https://github.com/rueckstiess/mtools)' log tools (`mloginfo`, `mlogfilter`) for the structured JSON log format MongoDB has used since 4.4 — the format mtools never supported. Built for DBAs and ops engineers running self-managed MongoDB 4.4 / 5.0 / 6.0 / 7.0 / 8.0.
|
|
6
|
+
|
|
7
|
+
> **Privacy by design: mdbkit never makes a network call.** It reads log files (or stdin) and writes to stdout. No telemetry, no phoning home, no cloud. Your logs never leave your machine. It is safe to run on air-gapped database hosts.
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
MongoDB 4.4 switched to structured JSON logging, and the beloved mtools log commands stopped working — the issue has been open since 2020. Meanwhile, index recommendations from MongoDB's Performance Advisor require a paid Atlas tier or Cloud/Ops Manager. If you run Community Edition on your own infrastructure, you're back to reading raw JSON logs with `grep` and `jq`.
|
|
12
|
+
|
|
13
|
+
mdbkit fills that gap: a single, dependency-free CLI that turns structured logs into answers.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pipx install mdbkit # recommended
|
|
19
|
+
# or
|
|
20
|
+
pip install mdbkit
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Zero runtime dependencies (pure Python stdlib), so it also installs cleanly on air-gapped hosts from a single wheel:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip download mdbkit -d ./wheels # on a connected machine
|
|
27
|
+
pip install --no-index --find-links ./wheels mdbkit # on the DB host
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Requires Python 3.9+.
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Overall log summary: versions, restarts, connection counts, error/warning totals
|
|
36
|
+
mdbkit loginfo /var/log/mongodb/mongod.log
|
|
37
|
+
|
|
38
|
+
# Slow queries grouped by query shape (literals stripped), ranked by total time
|
|
39
|
+
mdbkit queries mongod.log
|
|
40
|
+
mdbkit queries mongod.log --sort scanRatio --limit 10 --json
|
|
41
|
+
|
|
42
|
+
# Connection churn by source IP, appName, and driver
|
|
43
|
+
mdbkit connections mongod.log
|
|
44
|
+
|
|
45
|
+
# Filter raw log lines (output stays valid logv2 JSON — chainable)
|
|
46
|
+
mdbkit filter mongod.log --slow 500 --component COMMAND --ns shop.orders
|
|
47
|
+
mdbkit filter mongod.log --from 2026-07-01T08:00:00Z --to 2026-07-01T09:00:00Z | mdbkit queries -
|
|
48
|
+
|
|
49
|
+
# Rotated/compressed logs work directly
|
|
50
|
+
mdbkit queries mongod.log.2.gz
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Index advice
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
mdbkit advise mongod.log
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Produces **candidate** indexes from observed slow-query shapes using the ESR
|
|
60
|
+
(Equality → Sort → Range) guideline, with evidence, confidence, caveats, and a
|
|
61
|
+
validation step for every recommendation:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
[1] shop.orders — confidence: HIGH
|
|
65
|
+
query shape : {createdAt:gt, status:eq} sort:{createdAt:-1}
|
|
66
|
+
candidate : { status: 1, createdAt: -1 }
|
|
67
|
+
evidence : COLLSCAN observed in planSummary
|
|
68
|
+
evidence : in-memory sort (hasSortStage) observed
|
|
69
|
+
evidence : examined 251,400 docs to return 73 (3444:1)
|
|
70
|
+
caveat : Every index adds write and storage overhead ...
|
|
71
|
+
validate : Re-run the query with .explain('executionStats') ...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The advice gets sharper if you export your existing indexes and a sampled
|
|
75
|
+
schema. mdbkit never connects to your database — instead it prints small
|
|
76
|
+
`mongosh` scripts you run yourself, so you can read exactly what they do:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
mdbkit export-script indexes > export_indexes.js
|
|
80
|
+
mdbkit export-script schema > export_schema.js
|
|
81
|
+
mongosh --quiet "mongodb://localhost/shop" export_indexes.js > indexes.json
|
|
82
|
+
mongosh --quiet "mongodb://localhost/shop" export_schema.js > schema.json
|
|
83
|
+
|
|
84
|
+
mdbkit advise mongod.log --indexes indexes.json --schema schema.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
With `--indexes`, mdbkit checks each candidate against your existing indexes
|
|
88
|
+
(flagging when an existing index should already cover the query, or when a
|
|
89
|
+
candidate would make an existing index redundant — it flags, never suggests
|
|
90
|
+
dropping). With `--schema`, it warns about multikey (array) fields,
|
|
91
|
+
low-cardinality fields, and field-name typos. The schema export records field
|
|
92
|
+
**names and types only — no values.**
|
|
93
|
+
|
|
94
|
+
### Incident triage (beta)
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
mdbkit triage /var/log/mongodb/mongod.log # or a copied log + --no-sysprobe
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
One command during an incident: election/stepdown timeline, connection
|
|
101
|
+
storms, hot collections, error clusters, slow checkpoints — plus local
|
|
102
|
+
disk/memory/load probes when run on the DB host. Read-only: it never
|
|
103
|
+
connects to the database, and every finding ends with a next step for a
|
|
104
|
+
human to review. Detectors marked beta are validated against real logs
|
|
105
|
+
where available and clearly labeled where broader validation is pending.
|
|
106
|
+
|
|
107
|
+
### Explain-plan analysis
|
|
108
|
+
|
|
109
|
+
Got a slow query in hand rather than a log? Save its explain output and ask
|
|
110
|
+
mdbkit what's wrong:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# in mongosh: EJSON.stringify(db.orders.find({...}).sort({...}).explain("executionStats"))
|
|
114
|
+
mdbkit explain explain.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
You get the plan chain (`SORT -> COLLSCAN`), the examined/returned math, plain-
|
|
118
|
+
English verdicts (full collection scan, blocking in-memory sort, weakly
|
|
119
|
+
selective index, covered query), and — when the plan needs help — the same
|
|
120
|
+
evidence-backed candidate index the advisor would produce. Works with find and
|
|
121
|
+
aggregate explains, classic and SBE (6.0+) plans, and sharded winning plans.
|
|
122
|
+
|
|
123
|
+
### Design principles
|
|
124
|
+
|
|
125
|
+
* **Deterministic.** Same log in, same advice out. Rules, not AI. Every
|
|
126
|
+
recommendation shows its evidence and its rule of reasoning.
|
|
127
|
+
* **Candidates, not commands.** mdbkit never tells you to blindly run
|
|
128
|
+
`createIndex`, and never advises dropping an index.
|
|
129
|
+
* **Honest about uncertainty.** Shapes seen once are labeled low-confidence;
|
|
130
|
+
`$or`, `$regex`, `$in` and low-selectivity operators carry explicit caveats.
|
|
131
|
+
* **Offline, always.** No network code exists in this codebase.
|
|
132
|
+
|
|
133
|
+
## What it reads
|
|
134
|
+
|
|
135
|
+
Any MongoDB 4.4+ structured log: `mongod.log`, `mongos` logs, rotated `.gz`
|
|
136
|
+
files, or stdin (`-`). Slow-query lines (`"msg":"Slow query"`) are logged by
|
|
137
|
+
default for operations over `slowms` (100 ms); lower `slowms` or enable
|
|
138
|
+
profiling level 1 to capture more:
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
db.setProfilingLevel(1, { slowms: 50 })
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Pre-4.4 plain-text logs are detected and politely refused — for those, the
|
|
145
|
+
original mtools still works.
|
|
146
|
+
|
|
147
|
+
## Roadmap
|
|
148
|
+
|
|
149
|
+
Terminal output is and will remain first-class — this tool is built for the
|
|
150
|
+
Linux box the database actually runs on.
|
|
151
|
+
|
|
152
|
+
* **v0.2** — FTDC (`diagnostic.data`) decoding: offline summaries of the
|
|
153
|
+
metrics MongoDB already records on every node; election/failover timeline
|
|
154
|
+
from REPL events; per-shape drill-down.
|
|
155
|
+
* **v0.3** — shareable Markdown/HTML report export (for tickets and
|
|
156
|
+
post-incident reviews — a convenience layer, never a replacement for the
|
|
157
|
+
terminal).
|
|
158
|
+
|
|
159
|
+
mdbkit is validated against real-world structured logs (tens of thousands of
|
|
160
|
+
lines) in addition to its synthetic test fixtures.
|
|
161
|
+
|
|
162
|
+
## Bugs, feature requests, questions
|
|
163
|
+
|
|
164
|
+
Please use [GitHub Issues](../../issues) — it keeps problems and fixes public
|
|
165
|
+
so the next person can find them. Real-world log lines that parse wrongly are
|
|
166
|
+
the most valuable bug reports of all (redact literals first!).
|
|
167
|
+
|
|
168
|
+
## Security
|
|
169
|
+
|
|
170
|
+
mdbkit is offline by design: the codebase contains no network code, never
|
|
171
|
+
executes or evaluates input, and treats every log line as untrusted data
|
|
172
|
+
(strict JSON parsing only — shell constructors are never evaluated). See
|
|
173
|
+
[SECURITY.md](SECURITY.md) for the reporting process.
|
|
174
|
+
|
|
175
|
+
## Non-affiliation
|
|
176
|
+
|
|
177
|
+
mdbkit is an independent community project. It is **not affiliated with,
|
|
178
|
+
endorsed by, or sponsored by MongoDB, Inc.** "MongoDB" is a registered
|
|
179
|
+
trademark of MongoDB, Inc., used here only to describe compatibility.
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT — see [LICENSE](LICENSE).
|