Hi Team,
I have used pt-mongodb-query-digest to process the slow logs from my MongoDB database which is community server v4.0.
The first thing I understand about this is, this tool will fetch the details from the profiler, but when I used the below command it returns the output which is not in my system.profile collection.
pt-mongodb-query-digest -u admin -p --authenticationDatabase admin -d db_name 172.30.11.25:27017 -f text -o -ratio >output.txt
Then coming to the next point is that, You can find the below output of the pt-mongodb-query-digest which I ran to process and i could see two different types of queries with two different types of collection is used.
# Query 0: 0.00 QPS, ID 00cc75994e1954c19e91362f60ddeef4
# Ratio 5.16M (docs scanned/returned)
# Time range: 2024-05-29 00:30:15.611 +0000 UTC to 2024-05-29 00:33:18.446 +0000 UTC
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count (docs) 18
# Exec Time ms 0 125382 5611 15600 6966 15600 2137 6407
# Docs Scanned 2 46.40M 2.58M 2.58M 2.58M 2.58M 0.00 2.58M
# Docs Returned 0 9.00 0.00 1.00 0.50 1.00 0.50 0.50
# Bytes sent 0 4.93K 262.00 286.00 274.00 286.00 12.00 274.00
# String:
# Namespace penguin-consumer.notification_mail_response_logs
# Operation AGGREGATE
# Fingerprint AGGREGATE notification_mail_response_logs _id,alertType,createdAt,emailStatus,n,notificationType,siteContext
# Query {"ns":"penguin-consumer.notification_mail_response_logs","op":"command","command":{"aggregate":"notification_mail_response_logs","pipeline":[{"$match":{"createdAt":{"$gt":{"$numberLong":"1716834600000"},"$lt":{"$numberLong":"1716920999999"}},"emailStatus":{"$in":["SUCCESS","SUCCESS_WITH_NO_JOBS"]},"notificationType":"similarjobs","alertType":"daily","siteContext":"rexmonster"}},{"$group":{"_id":{"$numberInt":"1"},"n":{"$sum":{"$numberInt":"1"}}}}],"cursor":{},"$db":"penguin-consumer","$clusterTime":{"clusterTime":{"$timestamp":{"t":1716942597,"i":2614}},"signature":{"hash":{"$binary":{"base64":"K9h3H/U5QBmfKrkzVjQKUKf7bOw=","subType":"00"}},"keyId":{"$numberLong":"7354933565127131182"}}},"lsid":{"id":{"$binary":{"base64":"2FGXYyYdRE6CH/8AIbMY+g==","subType":"04"}}}},"originatingCommand":{"find":"user_event","filter":{"uuid":"bbcb3626-9d63-4450-b1b8-17cdf4579e08"},"$db":"penguin-consumer","$clusterTime":{"clusterTime":{"$timestamp":{"t":1716942611,"i":456}},"signature":{"hash":{"$binary":{"base64":"mWRKBxjtNtNBOMXngsDrOWXl7es=","subType":"00"}},"keyId":{"$numberLong":"7354933565127131182"}}},"lsid":{"id":{"$binary":{"base64":"lsGgjDD3S6SFYLy5f1Q5fQ==","subType":"04"}}}}}
The collectio in the query section and the originatingCommand is totally different and I can’t understand why getting such type of output.
Can anyone please explain this to me