log_fdw
log_fdw : foreign-data wrapper for Postgres log file access
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8810 | log_fdw | log_fdw | 1.4 |
FDW | Apache-2.0 | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | pg_sqlog file_fdw pg_stat_log logerrors pgelog aws_s3 pg_csv pg_bulkload pg_parquet pg_lake |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.4 |
18 17 16 15 14 | log_fdw |
- |
| RPM | PIGSTY | 1.4 |
18 17 16 15 14 | log_fdw_$v |
- |
| DEB | PIGSTY | 1.4 |
18 17 16 15 14 | postgresql-$v-log-fdw |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| el8.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| el9.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| el9.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| el10.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| el10.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| d12.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| d12.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| d13.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| d13.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| u22.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| u22.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| u24.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| u24.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| u26.x86_64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
| u26.aarch64 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 | PIGSTY 1.4 |
Source
github.com/aws/postgresql-logfdw
log_fdw-1.4.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Syntax:
Source: README
log_fdw is a PostgreSQL foreign data wrapper for reading PostgreSQL log files through SQL. It provides helper functions to list files in the server log directory and to create foreign tables for individual log files.
Core Functions
The upstream README documents two SQL entry points:
list_postgres_log_files() is a compatibility wrapper around PostgreSQL core’s pg_ls_logdir().
Basic Workflow
Create the extension and a foreign server:
List files available in the PostgreSQL log directory:
Create foreign tables for CSV logs or plain .log files:
Querying
Foreign tables created from plain log files expose a single log-entry style column, while CSV log files expose structured columns such as log_time, error_severity, message, and session metadata.
Typical usage is straightforward:
Privileges
Only superusers can create the extension. The README also notes that superusers can delegate access to non-superusers with the minimum required grants, for example:
pg_monitor is specifically needed when list_postgres_log_files() is used, because the underlying pg_ls_logdir() function requires it.
Build Notes
The project can be built standalone with PGXS:
The source can also be copied into PostgreSQL’s contrib tree and built there as part of a larger distribution.