1- <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.144 2007/09/10 02:01:19 tgl Exp $ -->
1+ <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.145 2007/09/22 19:10:44 tgl Exp $ -->
22
33<chapter Id="runtime-config">
44 <title>Server Configuration</title>
@@ -2262,11 +2262,13 @@ SELECT * FROM parent WHERE key = 2400;
22622262 This parameter can only be set in the <filename>postgresql.conf</>
22632263 file or on the server command line.
22642264 </para>
2265- <para> If <varname>log_destination</> is set to <systemitem>csvlog</systemitem>,
2266- the log is output as comma seperated values. The format is:
2267- timestamp with milliseconds, username, database name, session id, host:port number,
2268- process id, per process line number, command tag, session start time, transaction id,
2269- error severity, SQL state code, statement/error message.
2265+ <para>
2266+ If <systemitem>csvlog</> is included in <varname>log_destination</>,
2267+ log entries are output in <quote>comma separated
2268+ value</> format, which is convenient for loading them into programs.
2269+ See <xref linkend="runtime-config-logging-csvlog"> for details.
2270+ <varname>logging_collector</varname> must be enabled to generate
2271+ CSV-format log output.
22702272 </para>
22712273 </listitem>
22722274 </varlistentry>
@@ -2279,16 +2281,13 @@ SELECT * FROM parent WHERE key = 2400;
22792281 <listitem>
22802282 <para>
22812283 This parameter allows messages sent to <application>stderr</>,
2282- and CSV logs , to be
2284+ and CSV-format log output , to be
22832285 captured and redirected into log files.
2284- This method, in combination with logging to <application>stderr</>,
2285- is often more useful than
2286+ This approach is often more useful than
22862287 logging to <application>syslog</>, since some types of messages
22872288 might not appear in <application>syslog</> output (a common example
22882289 is dynamic-linker failure messages).
22892290 This parameter can only be set at server start.
2290- <varname>logging_collector</varname> must be enabled to generate
2291- CSV logs.
22922291 </para>
22932292 </listitem>
22942293 </varlistentry>
@@ -2334,12 +2333,13 @@ SELECT * FROM parent WHERE key = 2400;
23342333 file or on the server command line.
23352334 </para>
23362335 <para>
2337- If<varname>log_destination</> isset to <systemitem>csvlog </>,
2336+ IfCSV-format output isenabled in <varname>log_destination </>,
23382337 <literal>.csv</> will be appended to the timestamped
2339- <varname>log_filename</> to create the final log file name.
2340- (If log_filename ends in <literal>.log</>, the suffix is overwritten.)
2341- In the case of the example above, the
2342- file name will be <literal>server_log.1093827753.csv</literal>
2338+ log file name to create the file name for CSV-format output.
2339+ (If <varname>log_filename</> ends in <literal>.log</>, the suffix is
2340+ replaced instead.)
2341+ In the case of the example above, the CSV
2342+ file name will be <literal>server_log.1093827753.csv</literal>.
23432343 </para>
23442344 </listitem>
23452345 </varlistentry>
@@ -2617,88 +2617,92 @@ SELECT * FROM parent WHERE key = 2400;
26172617
26182618 </variablelist>
26192619
2620- <para>
2621- Here is a list of the various message severity levels used in
2622- these settings:
2623- <variablelist>
2624- <varlistentry>
2625- <term><literal>DEBUG[1-5]</literal></term>
2626- <listitem>
2627- <para>
2628- Provides information for use by developers.
2629- </para>
2630- </listitem>
2631- </varlistentry>
2620+ <para>
2621+ <xref linkend="runtime-config-severity-levels"> explains the message
2622+ severity levels used by <productname>PostgreSQL</>. If logging output
2623+ is sent to <systemitem>syslog</systemitem> or Windows'
2624+ <systemitem>eventlog</systemitem>, the severity levels are translated
2625+ as shown in the table.
2626+ </para>
26322627
2633- <varlistentry>
2634- <term><literal>INFO</literal></term>
2635- <listitem>
2636- <para>
2637- Provides information implicitly requested by the user,
2638- e.g., during <command>VACUUM VERBOSE</>.
2639- </para>
2640- </listitem>
2641- </varlistentry>
2628+ <table id="runtime-config-severity-levels">
2629+ <title>Message severity levels</title>
2630+ <tgroup cols="4">
2631+ <thead>
2632+ <row>
2633+ <entry>Severity</entry>
2634+ <entry>Usage</entry>
2635+ <entry><systemitem>syslog</></entry>
2636+ <entry><systemitem>eventlog</></entry>
2637+ </row>
2638+ </thead>
26422639
2643- <varlistentry>
2644- <term><literal>NOTICE</literal></term>
2645- <listitem>
2646- <para>
2647- Provides information that might be helpful to users, e.g.,
2648- truncation of long identifiers and the creation of indexes as part
2649- of primary keys.
2650- </para>
2651- </listitem>
2652- </varlistentry>
2640+ <tbody>
2641+ <row>
2642+ <entry><literal>DEBUG1..DEBUG5</></entry>
2643+ <entry>Provides successively-more-detailed information for use by
2644+ developers.</entry>
2645+ <entry><literal>DEBUG</></entry>
2646+ <entry><literal>INFORMATION</></entry>
2647+ </row>
26532648
2654- <varlistentry>
2655- <term><literal>WARNING</literal></term>
2656- <listitem>
2657- <para>
2658- Provides warnings to the user, e.g., <command>COMMIT</>
2659- outside a transaction block.
2660- </para>
2661- </listitem>
2662- </varlistentry>
2649+ <row>
2650+ <entry><literal>INFO</></entry>
2651+ <entry>Provides information implicitly requested by the user,
2652+ e.g., output from <command>VACUUM VERBOSE</>.</entry>
2653+ <entry><literal>INFO</></entry>
2654+ <entry><literal>INFORMATION</></entry>
2655+ </row>
26632656
2664- <varlistentry>
2665- <term><literal>ERROR</literal></term>
2666- <listitem>
2667- <para>
2668- Reports an error that caused the current command to abort.
2669- </para>
2670- </listitem>
2671- </varlistentry>
2657+ <row>
2658+ <entry><literal>NOTICE</></entry>
2659+ <entry>Provides information that might be helpful to users, e.g.,
2660+ notice of truncation of long identifiers.</entry>
2661+ <entry><literal>NOTICE</></entry>
2662+ <entry><literal>INFORMATION</></entry>
2663+ </row>
26722664
2673- <varlistentry>
2674- <term><literal>LOG</literal></term>
2675- <listitem>
2676- <para>
2677- Reports information of interest to administrators, e.g.,
2678- checkpoint activity.
2679- </para>
2680- </listitem>
2681- </varlistentry>
2665+ <row>
2666+ <entry><literal>WARNING</></entry>
2667+ <entry>Provides warnings of likely problems, e.g., <command>COMMIT</>
2668+ outside a transaction block.</entry>
2669+ <entry><literal>NOTICE</></entry>
2670+ <entry><literal>WARNING</></entry>
2671+ </row>
26822672
2683- <varlistentry>
2684- <term><literal>FATAL</literal></term>
2685- <listitem>
2686- <para>
2687- Reports an error that caused the current session to abort.
2688- </para>
2689- </listitem>
2690- </varlistentry>
2673+ <row>
2674+ <entry><literal>ERROR</></entry>
2675+ <entry>Reports an error that caused the current command to
2676+ abort.</entry>
2677+ <entry><literal>WARNING</></entry>
2678+ <entry><literal>ERROR</></entry>
2679+ </row>
26912680
2692- <varlistentry>
2693- <term><literal>PANIC</literal></term>
2694- <listitem>
2695- <para>
2696- Reports an error that caused all sessions to abort.
2697- </para>
2698- </listitem>
2699- </varlistentry>
2700- </variablelist>
2701- </para>
2681+ <row>
2682+ <entry><literal>LOG</></entry>
2683+ <entry>Reports information of interest to administrators, e.g.,
2684+ checkpoint activity.</entry>
2685+ <entry><literal>INFO</></entry>
2686+ <entry><literal>INFORMATION</></entry>
2687+ </row>
2688+
2689+ <row>
2690+ <entry><literal>FATAL</></entry>
2691+ <entry>Reports an error that caused the current session to
2692+ abort.</entry>
2693+ <entry><literal>ERR</></entry>
2694+ <entry><literal>ERROR</></entry>
2695+ </row>
2696+
2697+ <row>
2698+ <entry><literal>PANIC</></entry>
2699+ <entry>Reports an error that caused all database sessions to abort.</entry>
2700+ <entry><literal>CRIT</></entry>
2701+ <entry><literal>ERROR</></entry>
2702+ </row>
2703+ </tbody>
2704+ </tgroup>
2705+ </table>
27022706
27032707 </sect2>
27042708 <sect2 id="runtime-config-logging-what">
@@ -3082,27 +3086,32 @@ SELECT * FROM parent WHERE key = 2400;
30823086 </variablelist>
30833087 </sect2>
30843088 <sect2 id="runtime-config-logging-csvlog">
3085- <title>Usingthe csvlog </title>
3089+ <title>UsingCSV-Format Log Output </title>
30863090
30873091 <para>
30883092 Including <literal>csvlog</> in the <varname>log_destination</> list
30893093 provides a convenient way to import log files into a database table.
3090- Here is a sample table definition for storing csvlog output:
3094+ This option emits log lines in comma-separated-value format,
3095+ with these columns: timestamp with milliseconds, username, database
3096+ name, session id, host:port number, process id, per-process line
3097+ number, command tag, session start time, transaction id, error
3098+ severity, SQL state code, statement/error message.
3099+ Here is a sample table definition for storing CSV-format log output:
30913100 </para>
30923101
30933102<programlisting>
30943103CREATE TABLE postgres_log
30953104(
3096- log_time timestamp,
3105+ log_time timestamp with time zone ,
30973106 username text,
30983107 database_name text,
3099- sessionid text not null ,
3108+ sessionid text,
31003109 connection_from text,
3101- process_idtext ,
3102- process_line_numint not null ,
3110+ process_idinteger ,
3111+ process_line_numbigint ,
31033112 command_tag text,
3104- session_start_time timestamp,
3105- transaction_idint ,
3113+ session_start_time timestamp with time zone ,
3114+ transaction_idbigint ,
31063115 error_severity text,
31073116 sql_state_code text,
31083117 statement text,
@@ -3112,26 +3121,26 @@ CREATE TABLE postgres_log
31123121
31133122
31143123 <para>
3115- In order to import into this table, use the COPY FROM command:
3124+ To import a log file into this table, use the <command>COPY FROM</>
3125+ command:
31163126 </para>
31173127
31183128<programlisting>
31193129COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
31203130</programlisting>
31213131
31223132 <para>
3123- There are a few things you need toimport csvlog files easily and
3124- automatically:
3133+ There are a few things you need todo to simplify importing CSV log
3134+ files easily and automatically:
31253135
31263136 <orderedlist>
31273137 <listitem>
31283138 <para>
3129- Use a consistant, predictable naming scheme for your log files
3130- with <varname>log_filename</varname>. This lets you predict what
3131- the file name will be when it is ready to be imported.
3132- guess what
3133- the file name will be and know when an individual log file is
3134- complete and therefore ready to be imported.
3139+ Set <varname>log_filename</varname> and
3140+ <varname>log_rotation_age</> to provide a consistent,
3141+ predictable naming scheme for your log files. This lets you
3142+ predict what the file name will be and know when an individual log
3143+ file is complete and therefore ready to be imported.
31353144 </para>
31363145 </listitem>
31373146
@@ -3145,24 +3154,23 @@ guess what
31453154
31463155 <listitem>
31473156 <para>
3148- Set <varname>log_truncate_on_rotate </varname>= on so that old
3149- log data isn't mixed with the new in the same file.
3157+ Set <varname>log_truncate_on_rotation </varname>to <literal>on</> so
3158+ that old log data isn't mixed with the new in the same file.
31503159 </para>
31513160 </listitem>
31523161
31533162 <listitem>
31543163 <para>
3155- The example above includes a useful primary key on the log
3156- file data, which will protect against accidentally importing
3157- the same information twice. The COPY command commits all of
3158- the data it imports at one time, and any single error will
3159- cause the entire import to fail.
3160- If you import a partial log file and later import the file again
3161- when it is complete, the primary key violation will cause the
3162- import to fail. Wait until the log is complete and closed before
3163- import. This will also protect against accidently importing a
3164- partial line that hasn't been completely written, which would
3165- also cause the COPY to fail.
3164+ The table definition above includes a primary key specification.
3165+ This is useful to protect against accidentally importing the same
3166+ information twice. The <command>COPY</> command commits all of the
3167+ data it imports at one time, so any error will cause the entire
3168+ import to fail. If you import a partial log file and later import
3169+ the file again when it is complete, the primary key violation will
3170+ cause the import to fail. Wait until the log is complete and
3171+ closed before importing. This procedure will also protect against
3172+ accidentally importing a partial line that hasn't been completely
3173+ written, which would also cause <command>COPY</> to fail.
31663174 </para>
31673175 </listitem>
31683176 </orderedlist>