Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

Commit f9fa45b

Browse files
committed
adding an example bash script for logging unindexed queries
1 parent 954c5bc commit f9fa45b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

yesterdays-unindexed-queries.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Stick this in a crontab to run once a day and mail yourself your unindexed queries.
3+
# when you don't get an email - you don't have any unindexed queries.
4+
5+
# Until then see if you can identify why your queries are unindexed. It could be unavoidable
6+
7+
datestring=`date -d '1 day ago' +"%a %b %e"`
8+
logfile="/var/log/mongodb.log"
9+
grep nscanned $logfile | grep -v "nscanned:1 " | grep -v "nscanned:0 " | grep "$datestring"

0 commit comments

Comments
 (0)