## Sergiu Velescu (sergiu.vele...@endava.com): > OnLogin/Logout. > I want to log/audit each attempt to login (successful and/or not).
log_connections/log_disconnections > Who/how long was logged in DB (who logged in out of business hours > (maybe deny access)). Use PAM authentication. > Set session variable based on username (or maybe IP address) - > for example DATE format. "Based on user name": ALTER ROLE > OnStartup (or AfterStarted) > I want to start a procedure which check for a specific event in a loop > and send an email. That sounds like "problematic architecture" right from the start: - sending emails in a database transaction is not a good idea - active-waiting for events ("in a loop") is inefficient, try writing to a queue table and have a daemon read from that. > OnDDL > Log every DDL in a DB log table (who/when altered/created/dropped/ > truncated a specific object) and send an email. Event Triggers https://www.postgresql.org/docs/current/event-triggers.html > Duplicate WAL (to have WAL in 2 different places – for example I take > backup on separate disk and I want to have a copy of WAL on that disk) We have streaming replication/pg_receivewal or file based archiving, both also wrapped in practical products like barman, pgbackrest, ... Regards, Christoph -- Spare Space