1

is it possible to find out when was the users last connected to DB, and stored it in a table for tracking purpose, by writing trigger on pg_stat_activity view.?

Thank you

Raju
  • 27
  • 5
  • 1
    you can log every connection to your database by pg_audit extension, I would instead build functionality on logs rather than writing a trigger on pg_stat_activity. also, you can use log_connections and log_disconnections in postgresql.conf if you're only interested in connection logs – Nikhil B Jun 28 '23 at 15:57
  • Turn log_connections on and check your logfiles (automatically). – Frank Heikens Jun 28 '23 at 16:04

0 Answers0