Skip to content

Instantly share code, notes, and snippets.

@twerth
Created August 6, 2012 17:11
Show Gist options
  • Save twerth/3276723 to your computer and use it in GitHub Desktop.
Save twerth/3276723 to your computer and use it in GitHub Desktop.
MongoDB profiling
#!/bin/bash
mongod -vvvv --profile=2 --logpath /usr/local/var/log/mongodb/mongod.log -f /usr/local/etc/mongod.conf --fork
echo 'mongodb started'
#!/bin/bash
# Only show slow queries
#tail -f /usr/local/var/log/mongodb/mongod.log | highlight blue 'query:.*}' purple 'nscanned:[0-9]*' purple 'nreturned:[0-9]*' | egrep '[0-9]*[1-9]ms'
tail -f /usr/local/var/log/mongodb/mongod.log | highlight blue 'query:.*}' purple 'nscanned:[0-9]*' purple 'nreturned:[0-9]*' green '[0-9]*[0-9]ms' red '[0-9]*[1-9]ms'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment