Analyse MySQL General Query Log in Real-time?
题
We want to use mysql general query log to do real-time monitoring and auditing.
Currently our approach is:
- set general_log=on;
- sleep 15m;
- set general_log=off;
- scp & rm xxx.log;
- set general_log=on;...
But the main problem is when turn on/off general log it'll cause a peak of slow query.
I also thought of another approach: turn on genlog; tail -f it and send out the log; periodically truncate the logfile (with "> xxx.log" or "cat /dev/null >xxx.log").
I'm wondering whether it's practical.
If only mysql would provide some built-in general log message queue stuff...
没有正确的解决方案
不隶属于 dba.stackexchange