But the more interesting feature (also like tail) is to see the changes in "real time" with the -f option, and occasionally filter the result with grep to find a particular operation.
For example, if you want to see the logs from MYDATABASE, first you have to execute this:$ mongotail MYDATABASE -l 2
Then you can see the latest lines of logging with:
$ mongotail MYDATABASE
2015-02-24 19:17:01.194 QUERY [Company] : {"_id": ObjectId("548b164144ae122dc430376b")}
2015-02-24 19:17:01.195 QUERY [User] : {"_id": ObjectId("549048806b5d3db78cf6f654")}
2015-02-24 19:17:01.196 QUERY [Company] : {"_id": ObjectId("548b16df44ae122dc4303771")}
2015-02-24 19:17:10.729 COUNT [User] : {"active": {"$exists": true}, "firstName": {"$regex": "mac"}}
...
Now see the changes in "real time", and filter the result with egrep to find a particular operation, like only show writes operations:
mongotail databasename -f | egrep "(INSERT|UPDATE|REMOVE)"
See documentation and installation instructions in: https://github.com/mrsarm/mongotail
I hope will be usefull for you !
Hello, I made an open source command line tool to outputs any operation from a Mongo database in the standard output. You can see the operations collected by the database profiler from a console, or redirect the result to a file, pipes it with grep or other command line tool, etc.