logerrors
logerrors
logerrors : Function for collecting statistics about messages in logfile
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 7140 | logerrors | logerrors | 2.1.5 | SEC | BSD 3-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pgauditlogtofile pg_auth_mon pg_jobmon pg_stat_monitor auto_explain pg_track_settings pgaudit pgsentinel |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 2.1.5 | 18 17 16 15 14 | logerrors | - |
| RPM | PGDG | 2.1.5 | 18 17 16 15 14 | logerrors_$v | - |
| DEB | PIGSTY | 2.1.5 | 18 17 16 15 14 | postgresql-$v-logerrors | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 |
el8.aarch64 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 |
el9.x86_64 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 |
el9.aarch64 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 |
el10.x86_64 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 |
el10.aarch64 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 | PGDG 2.1.5 |
d12.x86_64 | PIGSTY 2.1.5 | PIGSTY 2.1.5 | PIGSTY 2.1.5 | PIGSTY 2.1.5 | PIGSTY 2.1.5 |
d12.aarch64 | PIGSTY 2.1.5 | PIGSTY 2.1.5 | PIGSTY 2.1.5 | PIGSTY 2.1.5 | PIGSTY 2.1.5 |
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 |
Source
pig build pkg logerrors; # build debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install logerrors; # install via package name, for the active PG version
pig install logerrors -v 18; # install for PG 18
pig install logerrors -v 17; # install for PG 17
pig install logerrors -v 16; # install for PG 16
pig install logerrors -v 15; # install for PG 15
pig install logerrors -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'logerrors';Create this extension with:
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 | 42601Slow Log Statistics
SELECT * FROM pg_slow_log_stats();
slow_count | reset_time
------------+----------------------------
1 | 2020-06-13 00:19:31.084923Reset Statistics
SELECT pg_log_errors_reset();Last updated on