Website keep getting hacked every day and every now and then we hear website owners react and tell "affected users that their password might had been compromised". Most sites that disclose such leaks know exactly which information was compromised and it often only affects a small portion of the user.
In all my setups, I save everything in one single database. If a hacker was to gain access to the database, how can I verify what has been compromised.
My question is: how can I monitor my database for database leaks? There would be a few attack vectors: a user could find a bug in my code and gain access to my admin interface. In that case a log would help. But what if the attack manages to connect to my database and send any SQL query he wants? What if the whole server gets compromised? He could just delete the logs, or even hide his actions. This way, I wouldn't even know I was hacked until users start complaining.
In my setups I use Postgres but I was hoping for mitigate/detection solutions that are not bound to one stack.