Is there an efficient way to log all DB queries in Staging and Production without having a big impact on performance?
Is there a good tool(free or paid) that does it?
The DB Engines I am working with are: MySql and MongoDB
Note: I know how to write all the DB queries into a log file. This solution is too slow for production and I am curious to know if there is a better way to store the logs and then easily find/browse them.
On MySQL you can get query templates and the associated counters from performance_schema. You can use PMM's query analytics to analyze this data.
Turn on the "general log". Beware -- it can chew up disk fast.
The output is all the queries being performed, and it is in a text file.
For chasing "slow" queries, use the slowlog.
(Both are built into MySQL.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.