I often monitor MySQL queries for some complex application components that use an ORM (Doctrine).
I’ve just made a special logger that re-runs all the quries with an EXPLAIN and log the “Extra” column of the explain query, in order to spot queries that can be improved. From the log, I pipe the result to “sed” with a regular expression, and colouring some text.
Sure you are not interested in this post. I just write some posts in order to find them easily in the future when I need them, and possibly helpting somebody else googling the same need.
Here the lines I’ve added to my ~/.bashrc
COLOR_RED=`echo -en 'e[31m'` COLOR_YELLOW=`echo -en 'e[93m'` COLOR_RESET=`echo -en 'e[00m'` alias querylog="tail -f /var/www/bnt/Public/application/logs/queries.log | sed -E 's/(where|intersect|temp|filesort)/$COLOR_RED1$COLOR_RESET/g'"