pg_auth_mon

pg_auth_mon

pg_auth_mon : monitor connection attempts per user

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
7150
pg_auth_mon
pg_auth_mon
3.0
SEC
MIT
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd-r
No
Yes
Yes
Yes
yes
no
Relationships
See Also
passwordcheck_cracklib
pgaudit
pgauditlogtofile
login_hook
auth_delay
credcheck
logerrors
set_user

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
MIXED
3.0
18
17
16
15
14
pg_auth_mon-
RPM
PGDG
3.0
18
17
16
15
14
pg_auth_mon_$v-
DEB
PIGSTY
3.0
18
17
16
15
14
postgresql-$v-pg-auth-mon-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PGDG 3.0
PGDG 3.0
PGDG 2.0
PGDG 2.0
PGDG 2.0
el8.aarch64
PGDG 3.0
PGDG 3.0
PGDG 2.0
PGDG 2.0
PGDG 2.0
el9.x86_64
PGDG 3.0
PGDG 3.0
PGDG 2.0
PGDG 2.0
PGDG 2.0
el9.aarch64
PGDG 3.0
PGDG 3.0
PGDG 2.0
PGDG 2.0
PGDG 2.0
el10.x86_64
PGDG 3.0
PGDG 3.0
PGDG 3.0
PGDG 3.0
PGDG 3.0
el10.aarch64
PGDG 3.0
PGDG 3.0
PGDG 3.0
PGDG 3.0
PGDG 3.0
d12.x86_64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
d12.aarch64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
d13.x86_64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
d13.aarch64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
u22.x86_64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
u22.aarch64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
u24.x86_64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
u24.aarch64
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PIGSTY 3.0
PackageVersionOSORGSIZEFile URL
pg_auth_mon_152.0el8.x86_64pgdg16.3 KiBpg_auth_mon_15-2.0-1.rhel8.x86_64.rpm
pg_auth_mon_151.0el8.x86_64pgdg23.5 KiBpg_auth_mon_15-1.0-1.rhel8.x86_64.rpm
pg_auth_mon_152.0el8.aarch64pgdg16.4 KiBpg_auth_mon_15-2.0-1.rhel8.aarch64.rpm
pg_auth_mon_151.0el8.aarch64pgdg23.5 KiBpg_auth_mon_15-1.0-1.rhel8.aarch64.rpm
pg_auth_mon_152.0el9.x86_64pgdg16.3 KiBpg_auth_mon_15-2.0-1.rhel9.x86_64.rpm
pg_auth_mon_151.0el9.x86_64pgdg23.9 KiBpg_auth_mon_15-1.0-1.rhel9.x86_64.rpm
pg_auth_mon_152.0el9.aarch64pgdg16.2 KiBpg_auth_mon_15-2.0-1.rhel9.aarch64.rpm
pg_auth_mon_151.0el9.aarch64pgdg23.7 KiBpg_auth_mon_15-1.0-1.rhel9.aarch64.rpm
pg_auth_mon_153.0el10.x86_64pgdg17.3 KiBpg_auth_mon_15-3.0-3PGDG.rhel10.x86_64.rpm
pg_auth_mon_153.0el10.aarch64pgdg17.4 KiBpg_auth_mon_15-3.0-3PGDG.rhel10.aarch64.rpm
postgresql-15-pg-auth-mon3.0d12.x86_64pigsty16.5 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~bookworm_amd64.deb
postgresql-15-pg-auth-mon3.0d12.aarch64pigsty16.7 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~bookworm_arm64.deb
postgresql-15-pg-auth-mon3.0d13.x86_64pigsty16.5 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~trixie_amd64.deb
postgresql-15-pg-auth-mon3.0d13.aarch64pigsty16.8 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~trixie_arm64.deb
postgresql-15-pg-auth-mon3.0u22.x86_64pigsty20.5 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~jammy_amd64.deb
postgresql-15-pg-auth-mon3.0u22.aarch64pigsty20.4 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~jammy_arm64.deb
postgresql-15-pg-auth-mon3.0u24.x86_64pigsty17.4 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~noble_amd64.deb
postgresql-15-pg-auth-mon3.0u24.aarch64pigsty17.4 KiBpostgresql-15-pg-auth-mon_3.0-3PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_auth_mon_142.0el8.x86_64pgdg16.2 KiBpg_auth_mon_14-2.0-1.rhel8.x86_64.rpm
pg_auth_mon_141.0el8.x86_64pgdg23.9 KiBpg_auth_mon_14-1.0-1.rhel8.x86_64.rpm
pg_auth_mon_142.0el8.aarch64pgdg16.3 KiBpg_auth_mon_14-2.0-1.rhel8.aarch64.rpm
pg_auth_mon_141.0el8.aarch64pgdg23.5 KiBpg_auth_mon_14-1.0-1.rhel8.aarch64.rpm
pg_auth_mon_142.0el9.x86_64pgdg16.3 KiBpg_auth_mon_14-2.0-1.rhel9.x86_64.rpm
pg_auth_mon_142.0el9.aarch64pgdg16.1 KiBpg_auth_mon_14-2.0-1.rhel9.aarch64.rpm
pg_auth_mon_141.0el9.aarch64pgdg23.7 KiBpg_auth_mon_14-1.0-1.rhel9.aarch64.rpm
pg_auth_mon_143.0el10.x86_64pgdg17.2 KiBpg_auth_mon_14-3.0-3PGDG.rhel10.x86_64.rpm
pg_auth_mon_143.0el10.aarch64pgdg17.4 KiBpg_auth_mon_14-3.0-3PGDG.rhel10.aarch64.rpm
postgresql-14-pg-auth-mon3.0d12.x86_64pigsty16.2 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~bookworm_amd64.deb
postgresql-14-pg-auth-mon3.0d12.aarch64pigsty16.7 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~bookworm_arm64.deb
postgresql-14-pg-auth-mon3.0d13.x86_64pigsty16.3 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~trixie_amd64.deb
postgresql-14-pg-auth-mon3.0d13.aarch64pigsty16.7 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~trixie_arm64.deb
postgresql-14-pg-auth-mon3.0u22.x86_64pigsty20.3 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~jammy_amd64.deb
postgresql-14-pg-auth-mon3.0u22.aarch64pigsty20.1 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~jammy_arm64.deb
postgresql-14-pg-auth-mon3.0u24.x86_64pigsty17.2 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~noble_amd64.deb
postgresql-14-pg-auth-mon3.0u24.aarch64pigsty17.3 KiBpostgresql-14-pg-auth-mon_3.0-3PIGSTY~noble_arm64.deb

Source

pig build pkg pg_auth_mon;		# build deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_auth_mon;		# install via package name, for the active PG version

pig install pg_auth_mon -v 18;   # install for PG 18
pig install pg_auth_mon -v 17;   # install for PG 17
pig install pg_auth_mon -v 16;   # install for PG 16
pig install pg_auth_mon -v 15;   # install for PG 15
pig install pg_auth_mon -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_auth_mon';

Create this extension with:

CREATE EXTENSION pg_auth_mon;

Usage

pg_auth_mon: Monitor authentication attempts

pg_auth_mon stores authentication attempt statistics per user, tracking successful and failed logins with timestamps.

CREATE EXTENSION pg_auth_mon;

Configuration

Add to postgresql.conf:

shared_preload_libraries = 'pg_auth_mon'

Optional GUC:

ParameterDefaultDescription
pg_auth_mon.log_period0Dump stats to Postgres log every N minutes (0=off)

Querying Authentication Stats

SELECT * FROM pg_auth_mon;

The pg_auth_mon view provides per-user information:

ColumnDescription
uidUser OID (0 for invalid/non-existing usernames)
successful_auth_countTotal number of successful logins
last_successful_authTimestamp of last successful login
failed_auth_countTotal number of failed authentications
last_failed_authTimestamp of last failed login
hba_conflicts_countCount of HBA file conflicts

All login attempts with invalid usernames are aggregated into a single row with OID 0.

Last updated on