mtools is a collection of helper scripts to parse, filter, and visualize MongoDB log files ( mongod ,
mongos ). mtools also includes mlaunch , a utility to quickly set up complex MongoDB test
environments on a local machine.
What’s in the box?
The following tools are in the mtools collection:
mlogfilter
slices log files by time, merges log files, filters slow queries, finds table scans, shortens log
lines, filters by other attributes, convert to JSON
mloginfo
returns info about log file, like start and end time, version, binary, special sections like
restarts, connections, distinct view
mplotqueries
visualize log files with different types of plots (requires matplotlib )
mlogvis
creates a self-contained HTML file that shows an interactive visualization in a web browser
(as an alternative to mplotqueries )
mlaunch
a script to spin up local test environments quickly, including replica sets and sharded
systems (requires pymongo )
mtransfer
an experimental script to transfer WiredTiger databases between MongoDB instances by
copying data files (requires pymongo and wiredtiger )
The mtools source code is available on GitHub under an Apache 2.0 license.
1、mlogfilter
A script to reduce the amount of information from MongoDB log files. mlogfilter takes one or
several MongoDB log files as input, together with some filter parameters, parses the contained
log lines and outputs the lines that match according to the filter parameters.
If several log files are provided, mlogfilter will merge them by timestamp and insert a marker at
the beginning of each line, before applying any of the other filters.
评论