Query Log

djdjohnson posted 7 years ago in Feature discussion
I love HeidiSQL, just for the record. And I've donated on a few occasions.

One feature that would be very helpful for my company would be a query log. We've had instances of our employees updating or deleting data that they shouldn't, and it would be nice if we had a way to review who did what and when. A log file (or collection of log files, with the connection name, and date in the filename, stored in a folder under the user's profile) would be hugely helpful. I'd like to see much of the same data that shows up in the log at the bottom of the window, but also timestamps as well. We probably don't need to see the queries automatically generated and executed by HeidiSQL (to retrieve schema data, etc.)... just operations done by the user... so queries executed, and any insert, update, delete, create, or alter operations performed. We don't need SELECT query results.

I know that we can enable the general log in MySQL, but our server is averaging more than 60 queries per second, so that log file would be absolutely enormous, taking up a ton of unnecessary space in addition to slowing down the server, so it isn't really an option.

ansgar posted 7 years ago
Did you notice HeidiSQL can log to files? Right click the query log window and click "Log to file". Another click will let you click "Open log folder".
ansgar posted 7 years ago
Ah, and in Tools > Preferences > Logging, you can chose which events are logged. This of course affects the query log and the log files.
djdjohnson posted 7 years ago
I need for the logging to be automatic. I can't rely on my employees to log every session every time. I know they won't do it.
ansgar posted 7 years ago
Automatic in what sense if not the way Heidi logs to file?
kalvaro posted 7 years ago
IMHO, client-side logging is a poor security mechanism.
djdjohnson posted 7 years ago
Alright, I just tested the built-in log feature and it does seem like it might work for us. The first time I ran it I guess Heidi must have crashed or something because it wasn't turned on the next time I launched the software. In any case, it looks perfect. You can close this feature request.

In response to kalvaro, we pretty much have to log at the client. Our web site generates about 50 GB of data in the MySQL general query log, per day, just through the normal course of doing business. It would be next to impossible to find one of the few dozen queries one of our employees runs in all of that data, especially because MySQL doesn't record the user account (or even timestamp) running the queries in its log. In other words, the server log is pretty much useless for us to try to track down a problem. It's just too much data, and we don't like the performance hit we take by logging everything like that. Our site has its own logs for the things our clients do, which is a much more efficient way to do it.
pmeraj posted 9 months ago

It is often required to obtain the output of a query in a file for later use. Oracle's PL / SQL has it.

Please login to leave a reply, or register at first.