sql-audit-cli-0.1.0 is not a library.
A CLI for managing sql-audit. Running this binary expects to find a file called "audit.toml" in the current directory. It will use the config in that file in order to:
- Create a new schema called
sql_audit
- Create a table in that schema called
audit
- Create a new function called
sql_audit_trigger
- Create a trigger on all tables in the
public
schema not excluded which inserts a new record intosql_audit.audit
any time an insert, update, or delete occurs containing copies of all the data.
Locals
When performing transactions within that public
schema, you can set some local values in a
transaction to track additional data.
SET LOCAL sql_audit.app_user = 'some_app_user';
is useful for recording an application-level user you want to track changes against, separate from the database user.SET LOCAL sql_audit.request_id = 'some request';
can be used for tracing multiple row changes against a single operation (e.g. web request).
audit.toml
Here are the configuration values you can provide in your audit.toml
= "postgres://user:password@host:port/database" # the database connection string
= ["some_table"] # A list of tables to exclude.