log_fdw
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
log_fdw | 1.4 | FDW | Apache-2.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 8810 | log_fdw | No | Yes | No | Yes | No | No | - |
PG18 fixed by vonng
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.4 | 1817161514 | log_fdw | - |
| RPM | PIGSTY | 1.4 | 1817161514 | log_fdw_$v | - |
| DEB | PIGSTY | 1.4 | 1817161514 | postgresql-$v-log-fdw | - |
Build
You can build the DEB packages for log_fdw using pig build:
Install
You can install log_fdw directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
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.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)