I'm searching for a way to keep track of any SELECT statements on a specific table in a database where logs are not enabled. I can't find any solutions to this except to force people to use a stored procedure to select data from the table and then log entries within that SP.

Is there a better solution to this problem? I do have full rights over processlist if that helps but given that the table I want to keep track of is pretty small, there's a good chance I may miss the queries between calls.

  • I have space constraints due to which general log cannot be enabled on that particular server
    – sumo_saka
    Jul 15 '21 at 21:01
  • 1
    There's any number of ways to send the log output to a remote machine instead of storing the log locally on the MySQL server.
    – mustaccio
    Jul 15 '21 at 22:06

Why track them?

If it is to see everything that is happening, use the general log.

If it is looking for performance issues, use the slowlog.

Neither the general nor slow logs limit output to specific table(s).

The Audit plugin, if available, is probably better for the former case.

Various "proxy" products could sit between clients and the server; they may be able to record all queries against a given table(s).

If users are going through a particular API, maybe it has the feature you desire.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.