logerrors

Function for collecting statistics about messages in logfile

Overview

PackageVersionCategoryLicenseLanguage
logerrors2.1.5SECBSD 3-ClauseC
IDExtensionBinLibLoadCreateTrustRelocSchema
7140logerrorsNoYesNoYesNoYes-
Relatedpgauditlogtofile pg_auth_mon pg_jobmon pg_stat_monitor auto_explain pg_track_settings pgaudit pgsentinel

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED2.1.51817161514logerrors-
RPMPGDG2.1.51817161514logerrors_$v-
DEBPIGSTY2.1.51817161514postgresql-$v-logerrors-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
d13.aarch64
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
u22.x86_64
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
u22.aarch64
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
u24.x86_64
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
u24.aarch64
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5
PIGSTY 2.1.5

Build

You can build the DEB packages for logerrors using pig build:

pig build pkg logerrors         # build DEB packages

Install

You can install logerrors directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

pig install logerrors;          # Install for current active PG version
pig ext install -y logerrors -v 18  # PG 18
pig ext install -y logerrors -v 17  # PG 17
pig ext install -y logerrors -v 16  # PG 16
pig ext install -y logerrors -v 15  # PG 15
pig ext install -y logerrors -v 14  # PG 14
dnf install -y logerrors_18       # PG 18
dnf install -y logerrors_17       # PG 17
dnf install -y logerrors_16       # PG 16
dnf install -y logerrors_15       # PG 15
dnf install -y logerrors_14       # PG 14
apt install -y postgresql-18-logerrors   # PG 18
apt install -y postgresql-17-logerrors   # PG 17
apt install -y postgresql-16-logerrors   # PG 16
apt install -y postgresql-15-logerrors   # PG 15
apt install -y postgresql-14-logerrors   # PG 14

Create Extension:

CREATE EXTENSION logerrors;

Usage

logerrors: Collect statistics about log messages

logerrors collects statistics about WARNING, ERROR, and FATAL messages in PostgreSQL log files, making it easy to monitor error rates without parsing logs.

CREATE EXTENSION logerrors;

Configuration Parameters

ParameterDefaultDescription
logerrors.interval5000 (5s)Time between writing stats to buffer (ms, max 60s)
logerrors.intervals_count120Number of intervals to keep in buffer (max 360)
logerrors.excluded_errcodes(empty)Error codes to exclude, comma-separated

Querying Error Statistics

SELECT * FROM pg_log_errors_stats();
 time_interval |  type   |       message        | count | username | database | sqlstate
---------------+---------+----------------------+-------+----------+----------+----------
               | WARNING | TOTAL                |     0 |          |          |
               | ERROR   | TOTAL                |     1 |          |          |
               | FATAL   | TOTAL                |     0 |          |          |
             5 | ERROR   | ERRCODE_SYNTAX_ERROR |     1 | postgres | postgres | 42601
           600 | ERROR   | ERRCODE_SYNTAX_ERROR |     1 | postgres | postgres | 42601

Slow Log Statistics

SELECT * FROM pg_slow_log_stats();
 slow_count |         reset_time
------------+----------------------------
          1 | 2020-06-13 00:19:31.084923

Reset Statistics

SELECT pg_log_errors_reset();

Last Modified 2026-03-12: add pg extension catalog (95749bf)