On Fri, Aug 21, 2020 at 09:25:20AM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/12/runtime-config-logging.html > Description: > > There is some imperfection in PostgreSQL doc. There are two section in > documentation how to import PostgreSQL log into sql space and both not > complete. One of them is: > https://www.postgresql.org/docs/current/file-fdw.html > Example F.1. Create a Foreign Table for PostgreSQL CSV Logs > Here is described how to config file-fdw to get access to the PostgreSQL > logs, but there is not description or a link how to config PostgreSQL log > for this. > > Other section is: > https://www.postgresql.org/docs/12/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG > 19.8.4. Using CSV-Format Log Output > Here is described how to configure PostgreSQL log to import it into > previously created ordinary table by COPY command. May be this configuration > is compatible with "Example F.1. Create a Foreign Table for PostgreSQL CSV > Logs", but this method is not mentioned. > > My idea to improve documentation by adding cross link: to section «Example > F.1. Create a Foreign Table for PostgreSQL CSV Logs» add link to «19.8.4. > Using CSV-Format Log Output» as example of log configuration and to section > «19.8.4. Using CSV-Format Log Output» add link to «Example F.1. Create a > Foreign Table for PostgreSQL CSV Logs» as one more example how PostgreSQL > logs can be imported inside PostgreSQL.
Good idea. People have been confused about this before. Attached is a patch. -- Bruce Momjian <br...@momjian.us> https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 7a7177c550..7130a187f2 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7075,6 +7075,8 @@ CREATE TABLE postgres_log <programlisting> COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; </programlisting> + It is also possible to access the file as a foreign data wrapper + using <xref linkend="file-fdw"/>. </para> <para> diff --git a/doc/src/sgml/file-fdw.sgml b/doc/src/sgml/file-fdw.sgml index ed028e4ec9..c3e40f435c 100644 --- a/doc/src/sgml/file-fdw.sgml +++ b/doc/src/sgml/file-fdw.sgml @@ -215,7 +215,9 @@ <para> One of the obvious uses for <literal>file_fdw</literal> is to make the PostgreSQL activity log available as a table for querying. To - do this, first you must be logging to a CSV file, which here we + do this, first you must be <link + linkend="runtime-config-logging-csvlog">logging to a CSV file,</link> + which here we will call <literal>pglog.csv</literal>. First, install <literal>file_fdw</literal> as an extension: </para>