From 70a7b4776be4e776221e578d8ca53b2b9f8118c0 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 15 Mar 2020 11:20:21 +0100 Subject: Add backend type to csvlog and optionally log_line_prefix The backend type, which corresponds to what pg_stat_activity.backend_type shows, is added as a column to the csvlog and can optionally be added to log_line_prefix using the new %b placeholder. Reviewed-by: Julien Rouhaud Reviewed-by: Kuntal Ghosh Reviewed-by: Alvaro Herrera Reviewed-by: Justin Pryzby Discussion: https://www.postgresql.org/message-id/flat/c65e5196-4f04-4ead-9353-6088c19615a3@2ndquadrant.com --- doc/src/sgml/config.sgml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 371d7838fb6..3cac340f323 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -6438,9 +6438,13 @@ local0.* /var/log/postgresql right with spaces to give it a minimum width, whereas a positive value will pad on the left. Padding can be useful to aid human readability in log files. + + + This parameter can only be set in the postgresql.conf file or on the server command line. The default is '%m [%p] ' which logs a time stamp and the process ID. + @@ -6477,6 +6481,11 @@ local0.* /var/log/postgresql Remote host name or IP address yes + + %b + Backend type + no + %p Process ID @@ -6548,6 +6557,14 @@ local0.* /var/log/postgresql + + The backend type corresponds to the column + backend_type in the view , but additional types can appear + in the log that don't show in that view. + + + The %c escape prints a quasi-unique session identifier, consisting of two 4-byte hexadecimal numbers (without leading zeros) separated by a dot. The numbers are the process start time and the @@ -6772,7 +6789,7 @@ log_line_prefix = '%m [%p] %q%u@%d/%a ' character count of the error position therein, location of the error in the PostgreSQL source code (if log_error_verbosity is set to verbose), - and application name. + application name, and backend type. Here is a sample table definition for storing CSV-format log output: @@ -6801,6 +6818,7 @@ CREATE TABLE postgres_log query_pos integer, location text, application_name text, + backend_type text, PRIMARY KEY (session_id, session_line_num) ); -- cgit v1.2.3