logerrors
Function for collecting statistics about messages in logfile
Repository
munakoiso/logerrors
https://github.com/munakoiso/logerrors
Source
logerrors-2.1.5.tar.gz
logerrors-2.1.5.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
logerrors | 2.1.5 | SEC | BSD 3-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7140 | logerrors | No | Yes | No | Yes | No | Yes | - |
| Related | pgauditlogtofile pg_auth_mon pg_jobmon pg_stat_monitor auto_explain pg_track_settings pgaudit pgsentinel |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 2.1.5 | 1817161514 | logerrors | - |
| RPM | PGDG | 2.1.5 | 1817161514 | logerrors_$v | - |
| DEB | PIGSTY | 2.1.5 | 1817161514 | postgresql-$v-logerrors | - |
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 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
| Parameter | Default | Description |
|---|---|---|
logerrors.interval | 5000 (5s) | Time between writing stats to buffer (ms, max 60s) |
logerrors.intervals_count | 120 | Number 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();
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.