June 13th, 2013, 05:38 AM
MySQL Database Logging
I understand that we can set the path in my.ini to enable the General Log for MySQL database which will log every event (data access from SQLyog or from application) into the file.
The problem is this log file will keep growing very fast to reach GB file size if my application is running within an hour.
I wish to know is there other way that i can split the file lets say based on file size or date???
Or is there any other setting to configure or limit the logging event or pattern so that it won't just log everything that have changed on database???
Thanks in advanced for any help or suggestion.
June 13th, 2013, 05:55 PM
You can limit the logging to only log queries that take longer than a particular number of seconds to execute. If the purpose of logging every query is to analyze performance, then using this option makes sense because it allows you to ignore fast queries.
Splitting logs is often done by an external program like logrotate. I know logrotate can be configured to rotate the log files on a daily basis; I'm not sure, but it might be possible to configure it to rotate the log files on an hourly basis too.