Examples¶
1) Slow queries only¶
qh mongodb.log --slow
2) COLLSCANs only¶
qh mongodb.log --scan
3) Namespace + minimum duration filter¶
qh mongodb.log --namespace app.users --min-ms 50
4) Percentile stats + CSV export¶
qh mongodb.log --pstats --output-csv report.csv
5) Filter raw lines by keywords (plus summary)¶
qh mongodb.log --filter "index" "COLLSCAN"
6) Connection sources (Remote IP + App)¶
qh mongodb.log --connections
Verbose (no truncation):
qh mongodb.log --connections --verbose
7) Slow queries with full plan summaries¶
qh mongodb.log --slow --verbose
8) Slow COLLSCAN queries with percentile stats¶
qh mongodb.log --slow --scan --pstats
9) Slow queries within a date range¶
qh mongodb.log --slow --start-date 2025-09-10 --end-date 2025-09-12
With percentile stats + verbose:
qh mongodb.log --slow --start-date 2025-09-10T00:00:00 --end-date 2025-09-12T23:59:59 --pstats --verbose
10) Inspect only errors and fatals¶
qh mongodb.log --error
Show full messages:
qh mongodb.log --error --verbose
11) Focus on one percentile¶
qh mongodb.log --slow --pvalue P90
12) Drill into a namespace and export¶
qh mongodb.log --scan --namespace sales.orders --output-csv sales_collscan.csv
12a) Slow threshold set to 250ms¶
qh mongodb.log --slow 250
13) Combine filter & error mode¶
qh mongodb.log --filter "ReplicaSetMonitor" --error
14) Top 10 distinct queries¶
qh mongodb.log --query
Show with full details (no truncation):
qh mongodb.log --query --verbose
15) Queries for specific namespace¶
qh mongodb.log --query --namespace myapp.users
16) Streaming input via pipes (stdin)¶
QueryHound can read logs from standard input. Use - explicitly or rely on auto-detection when piping.
Explicit stdin:
tail -f /var/log/mongodb/mongod.log | qh - --slow
Auto-detect piped input:
zcat mongo.log.gz | qh --error
Works with all modes, for example query analysis from a pipeline:
cat mongo.json | qh --query
17) Inspect warnings¶
qh mongodb.log --warn
Focus on common operational warnings:
qh mongodb.log --warn --filter "MaxTimeMSExpired|ClientDisconnect|deprecated"
18) Combine warnings and errors¶
qh mongodb.log --error --warn