Pcornel
Databases · Database Security

Database Auditing

Cheat sheet · https://pcornel.dk/topic.php?topic=6193

Back to the Topic

Answer

Database auditing records who did what — logins, privilege changes, DDL and access to sensitive data — using pgAudit, MariaDB audit plugin, MySQL Enterprise Audit or SQL Server Audit.

Remember

Audit privileged actions and sensitive tables, not every SELECT. Ship audit logs off the server. Watch performance impact.

First checks

  • sys.server_audits — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version

Verify in this order

action → audit rule → record → central log

Where it usually breaks

Auditing every SELECT on a busy system can hurt performance and fill disks.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6193

Confirmation

Confirm action

Continue?