pg_sqlog
Provide SQL interface to logs
Repository
kouber/pg_sqlog
https://github.com/kouber/pg_sqlog
Source
pg_sqlog-1.6.tar.gz
pg_sqlog-1.6.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_sqlog | 1.6 | STAT | BSD-3-Clause | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 6500 | pg_sqlog | No | Yes | No | Yes | No | No | sqlog |
| Related | file_fdw log_fdw pg_stat_log logerrors pgelog file_fdw pg_csv aws_s3 pgdisablelogerror pgaudit pg_auth_mon |
|---|
require certain params
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.6 | 1817161514 | pg_sqlog | file_fdw |
| RPM | PIGSTY | 1.6 | 1817161514 | pg_sqlog_$v | - |
| DEB | PIGSTY | 1.6 | 1817161514 | postgresql-$v-pg-sqlog | - |
Build
You can build the RPM / DEB packages for pg_sqlog using pig build:
Install
You can install pg_sqlog 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
Create Extension:
Usage
pg_sqlog provides a SQL interface for querying PostgreSQL CSV log files using a foreign table backed by file_fdw.
Querying Logs
Slow Query Analysis
Functions
| Function | Description |
|---|---|
sqlog.log([timestamp]) | Returns log contents for a given day |
sqlog.set_date([timestamp]) | Set the date for sqlog.log table queries |
sqlog.duration(text) | Extract query duration from message (ms) |
sqlog.preparable_query(text) | Replace arguments with ? for grouping |
sqlog.summary(text, int, int) | Strip metadata, show first/last N chars |
sqlog.temporary_file_size(text) | Extract temp file size from message |
sqlog.autovacuum([timestamp]) | Autovacuum report for a given day |
sqlog.autoanalyze([timestamp]) | Autoanalyze report for a given day |
Autovacuum Reports
Prerequisites
Required postgresql.conf settings:
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)