pg_auth_mon
monitor connection attempts per user
Repository
RafiaSabih/pg_auth_mon
https://github.com/RafiaSabih/pg_auth_mon
Source
pg_auth_mon-3.0.tar.gz
pg_auth_mon-3.0.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_auth_mon | 3.0 | SEC | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7150 | pg_auth_mon | No | Yes | Yes | Yes | No | Yes | - |
| Related | set_user login_hook pg_session_jwt auth_delay logerrors pg_stat_log pgelog pgaudit pg_permissions |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 3.0 | 1817161514 | pg_auth_mon | - |
| RPM | PGDG | 3.0 | 1817161514 | pg_auth_mon_$v | - |
| DEB | PIGSTY | 3.0 | 1817161514 | postgresql-$v-pg-auth-mon | - |
Build
You can build the DEB packages for pg_auth_mon using pig build:
Install
You can install pg_auth_mon directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Preload:
Create Extension:
Usage
pg_auth_mon stores authentication attempt statistics per user, tracking successful and failed logins with timestamps.
Configuration
Add to postgresql.conf:
Optional GUC:
| Parameter | Default | Description |
|---|---|---|
pg_auth_mon.log_period | 0 | Dump stats to Postgres log every N minutes (0=off) |
Querying Authentication Stats
The pg_auth_mon view provides per-user information:
| Column | Description |
|---|---|
uid | User OID (0 for invalid/non-existing usernames) |
successful_auth_count | Total number of successful logins |
last_successful_auth | Timestamp of last successful login |
failed_auth_count | Total number of failed authentications |
last_failed_auth | Timestamp of last failed login |
hba_conflicts_count | Count of HBA file conflicts |
All login attempts with invalid usernames are aggregated into a single row with OID 0.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)