You can log the queries to either FILE or TABLE in MySQL itself by specifying the log_output variable, which can be either FILE or TABLE, or both FILE and TABLE.
If you specify log_output as FILE, the general query log and the slow query log will be written to the files specified by general_log_file and slow_query_log_file, respectively.
If you specify log_output as TABLE, the general query log and the slow query log will be written to the mysql.general_log and mysql.slow_log tables respectively. Log contents are accessible through SQL statements.
mysql> SET @@GLOBAL.log_output='TABLE';Query OK, 0 rows affected (0.00 sec)mysql> SET @@GLOBAL.general_log='ON';Query OK, 0 rows affected (0.02 ...