I needed to debug some Drupal database queries generated by the Search API DB module.
You can configure MySQL to dump every query to a log file. You can then use tail -f
and grep --line-buffered
to narrow the output down to a specific search pattern.
log into MySQL and run the following:
SET GLOBAL general_log = 'ON'; SHOW VARIABLES LIKE "general_log%"; exit;
I'm going to assume the path to your general_log_file
is: /var/lib/mysql/usb-dev.log
.
Grep the results of tail
by running the following from your terminal:
sudo tail -f /var/lib/mysql/usb-dev.log | grep --line-buffered sometestpattern
Leave the terminal window open and start browsing your site. When a query matches your search pattern, you should see that line printed to the terminal.
Software engineer by profession, embedded systems tinkerer, husband, father, fantasy novel devourer, wine lush, beer and cheese connoisseur