ERROR REPORTING AND LOGGING Category Parameters

This document describes the parameters related to error reporting and log categories in system configuration parameters.

Notes!
To ensure the stability and security of the system, please be sure to manually modify the relevant parameters**.


Where to Log

event_source


When logging to event is enabled, this parameter determines the program name used to identify the YMatrix message in the log.

Data Type Default Set Category
string PostgreSQL segments; system; restart

logging_collector


This parameter enables the log collector, which is a background process that captures log messages sent to stderr and it redirects those messages to the log file.

  • This method is usually more useful than logging to syslog, because certain types of messages do not appear in the syslog output (such as dynamic linker error messages, error messages generated by scripts such as archive_command, etc.).
  • This parameter can only be set when the server starts.
  • Note: You can also log the log to stderr without using the log collector. Log messages will only go to the location where stderr is directed to the server. However, that approach is only suitable for low log volumes, as it does not provide a way to rotate log files. Also, on some platforms that do not use log collectors, log output may be lost or confusing, because multiple processes will overwrite each other's output when writing to the same log file concurrently.
  • Note:Log collector never loses messages. This means that under extremely high loads, if the server process tries to send more log messages when the collector is already lagging behind, it will be blocked. Instead, syslog tends to drop messages when they cannot be written, meaning that in such cases it may not be able to log certain messages, but it does not block other parts of the system.
Data Type Default Set Category
boolean on segments; system; restart

log_destination


YMatrix supports multiple methods to log server messages, setting this parameter to a list of desired log destinations, separated by commas.

  • If csvlog is included in log_destination, the log entry will be output in the "comma-separated values" (CSV) format, which makes it easy to load the log into the program. To generate log output in CSV format, logging_collector must be enabled.
  • When stderr or csvlog is included, the file current_logfiles is created to record the location of the log file currently being used by the log collector and the associated log destination. This provides a convenient means of finding the logs currently in use by a node instance. Here is an example of the contents of the file:
    stderr log/postgresql.log
    csvlog log/postgresql.csv

    When the rotation effect creates a new log file and log_destination is overloaded, the current_logfiles file is rebuilt. When log_destination does not include stderr and csvlog and the log collector is disabled, this file is deleted.

  • Note: On most Unix systems, you will need to modify the system's syslog daemon configuration to use the syslog option of log_destination. YMatrix can log to syslog facilities LOCAL0 through LOCAL7 (see syslog_facility), but the default syslog configuration on most platforms discards all such messages. You will need to add the following to the syslog daemon's configuration file to make it work: local0.* /var/log/postgresql.
  • On Windows, when using the eventlog option of log_destination, you should register an event source and library in the operating system so that the Windows Event Viewer can clearly display event log messages.
Data type Default value Value range Setting category
string stderr stderr / csvlog / syslog / eventlog(on Windows) segments;system;reload

log_directory


When logging_collector is enabled, this parameter determines the directory where log files will be created.

  • It can be specified as an absolute path or a relative path to the cluster data directory.
Data type Default value Setting category
string log segments;system;reload

log_file_mode


Set the creation mode for log files.

  • On Unix systems, when logging_collector is enabled, this parameter sets the permissions for log files (this parameter is ignored on Microsoft Windows).
  • The default permission is 0600, which means that only the server owner can read or write to the log file.
  • Another commonly used setting is 0640, which allows members of the owner's group to read the file. Note: You must modify log_directory to a location outside the cluster data directory for this setting to take effect.
  • Note: Under no circumstances should log files be made readable by anyone, as they may contain sensitive data.
Data type Default value Value range Setting category
int 0600 0000 ~ 0777 segments;system;reload

log_filename


When logging_collector is enabled, this parameter sets the filename of the log file that is created.

  • The value is treated as a strftime pattern, so % escapes can be used to specify filenames that change based on time (note that if there are any timezone-independent % escapes, the calculation will be performed in the timezone specified by log_timezone (see below)). Supported % escapes are similar to those listed in the Open Organization's strftime documentation. Note that the system's strftime is not used directly, so platform-specific (non-standard) extensions will not work.
  • If you do not use escapes to specify a filename, you should plan to use a log rotation tool to avoid eventually filling up the entire disk.
  • If CSV format output is enabled in log_destination, .csv will be appended to the timestamp log filename to create CSV format output (if log_filename ends with .log, that suffix will be replaced).
Data type Default value Setting category
string gpdb-%Y-%m-%d_%H%M%S.csv segments;system;reload

log_rotation_age


Specify the time (in minutes) that the YMatrix database writes messages to the activity log file.

  • After this period of time, the file will be closed and a new log file will be created.
  • Set to 0 to disable the creation of new log files based on time.
  • The default value is 1440 minutes, which is 1 day.
Data type Default value Value range Setting category
int 1440 0 ~ (INT_MAX/60) master;system;restart

log_rotation_size


Specify the size (in KB) of a single log file that triggers rotation.

  • When the log file size is equal to or greater than this size, the file is closed and a new log file is created.
  • Set to zero to disable the creation of new log files based on size.
  • The maximum value is INT_MAX. If an invalid value is specified, the default value is used.
  • The default value is 1048576KB, which is 1GB.
Data type Default value Value range Setting category
int 1048576 0 ~ (INT_MAX/1024) master;system;restart

log_truncate_on_rotation


Truncate (overwrite) rather than append to any existing log files with the same name.

  • However, truncation only occurs when a new file is opened due to time-based rotation; it does not occur when the server starts up or during size-based rotation. If disabled, existing files will be appended to in all cases. For example, using this setting with a log_filename similar to gpseg-%H.log will result in 24-hour log files being generated and cyclically overwritten.
  • Example: Suppose you want to retain 7 days of logs, with one log file per day named server_log.Mon, server_log.Tue, and so on, and automatically overwrite last week's logs with this week's logs. Then you can: set log_filename to server_log.%a, set log_truncate_on_rotation to on, and set log_rotation_age to 7d.
  • Example: If you want to retain 24 hours of logs, with one log file per hour, but rotate when the log file size exceeds 1GB. Then you can: set log_filename to server_log.%H%M, set log_truncate_on_rotation to on, set log_rotation_age to 1h, and set log_rotation_size to 10MB. Including the %M character in log_filename allows for any size-driven rotation to occur, selecting a new filename that differs from the initial filename for each hour.
Data Type Default Value Setting Category
boolean off master;system;restart

syslog_facility


When logging to syslog is enabled, this parameter determines the syslog device to use.

Data type Default value Value range Setting category
enum LOCAL0 LOCAL0 / LOCAL1 / LOCAL2 / LOCAL3 / LOCAL4 / LOCAL5 / LOCAL6 / LOCAL7 segments;system;reload

syslog_ident


When logging to syslog is enabled, this parameter determines the program name used to identify YMatrix messages in syslog.

Data type Default value Setting category
string postgres segments;system;reload

syslog_sequence_numbers


When logs are recorded to syslog and this setting is set to on (default), each message is prefixed with an incrementing sequence number.

  • This behavior avoids the “--- Previous message repeated N times ---” format that many syslog implementations use by default. In modern syslog implementations, avoiding duplicate messages is configurable (e.g., $RepeatedMsgReduction in rsyslog), so this parameter may not be necessary.
  • Additionally, if you truly wish to avoid duplicate messages, you can set this parameter to off.
Data Type Default Value Setting Category
boolean on segments;system;reload

syslog_split_messages

When logging to syslog is enabled, this parameter determines how messages are delivered to syslog. - When set to on (default), messages are split into lines, and long lines are also split to fit within 1024 bytes, which is a typical size limit in traditional syslog implementations.

  • When set to off, YMatrix server log messages are sent to the syslog service as-is, and the task of handling large messages is handled by the syslog service.
  • If syslog is ultimately logged to a text file, both settings produce the same result, but it is recommended to set it to on. This is because most syslog implementations either cannot handle large messages or require special configuration to do so. However, if syslog is ultimately written to some other medium, it is necessary to maintain the logical integrity of the messages (which is also more useful).
Data type Default value Setting category
boolean on segments;system;reload


When to Log

gp_interconnect_debug_retry_interval


Specifies the time interval (in seconds) at which YMatrix database interconnect debug messages are logged when the server configuration parameter gp_log_interconnect is set to debug.

  • Log messages contain information about interconnect communication between YMatrix database Segment instance worker processes.
  • This information may be helpful when debugging network issues between Segment instances.
Data type Default value Value range Setting category
int 10 1 ~ 4096 master;session;reload

log_min_duration_statement


If the duration of a statement is greater than or equal to the specified time (in milliseconds), the statement and its duration are recorded in a single log line.

  • Setting this value to 0 will print all statements and their durations.
  • -1 disables this feature.
  • For example, if set to 250, all SQL statements that run for 250 milliseconds or longer will be logged.
  • Enabling this option can be used to track unoptimized queries in the application.
Data type Default value Value range Setting category
int -1 -1 ~ INT_MAX master;session;reload;superuser

log_min_error_statement


Control whether SQL statements that cause errors are still logged in the server log.

  • Log all SQL statements that cause errors of the specified level or higher.
  • Enabling this option helps track the source of any errors that appear in the server log.
Data type Default value Value range Setting category
enum error debug5 / debug4 / debug3 / debug2 / debug1 / info / notice / warning / error / fatal / panic
Each level includes all subsequent levels.
The later the level, the fewer messages are sent.
master;session;reload;superuser

log_min_messages


Control which message levels are written to the server log.

  • Note: log has a different ranking in this parameter than in client_min_messages.
Data type Default value Value range Setting category
enum warning debug5 / debug4 / debug3 / debug2 / debug1 / info / notice / warning / error / log / fatal / panic
Each level includes all subsequent levels.
The later the level, the fewer messages are sent.
master;session;reload;superuser

log_statement_sample_rate


Set the proportion of statements whose duration exceeds log_min_duration_statement that will be logged.

  • Sampling is random; for example, 0.5 means there is a 50% chance of logging any given statement.
  • The default value is 1.0, which means all sampled statements are logged. 0.0 disables sampling of statement duration logging, equivalent to setting log_min_duration_sample to -1.
  • Only superusers and users with the appropriate SET privileges can modify this setting.
Data type Default value Valid range Setting category
floating point 1.0 0.0 ~ 1.0 segments;session;reload;superuser

log_transaction_sample_rate


The section where all statements are logged for a transaction, as well as statements logged for other reasons.

  • It applies to each new transaction, regardless of the duration of its statements.
  • 0 indicates that no additional statements for the transaction are logged. 1 indicates that all statements for all transactions are logged.
  • This parameter helps track transaction samples.
  • Note: Like all statement-logging options, this option may introduce significant overhead.
Data type Default value Value range Setting category
real 0.001 0.0 ~ 1.0 segments;session;reload;superuser

The following table explains the message severity levels used by YMatrix. If log output is sent to syslog or Windows eventlog, the severity level will be converted as shown in the table.

Severity Usage syslog eventlog
DEBUG1..DEBUG5 Provides developers with continuous, more detailed information DEBUG INFORMATION
INFO Provides information implicitly requested by the user, such as output from VACUUM VERBOSE INFO INFORMATION
NOTICE Provides information that may be useful to the user, such as long identifier truncation warnings NOTICE INFORMATION
WARNING Provides warnings about potential issues, such as COMMIT outside a transaction block NOTICE WARNING
ERROR Reports an error that caused the current command to terminate WARNING ERROR
LOG Reports information that may be of interest to administrators, such as checkpoint activity INFO INFORMATION
FATAL Reports an error that caused the current session to terminate ERR ERROR
PANIC Reports an error that caused all database sessions to terminate CRIT ERROR

optimizer_minidump


The Greenplum GPORCA optimizer generates minidump files to describe the optimization context for a given query.

  • The information format in the file is not easy to debug or troubleshoot. The minidump file is located in the main data directory and uses the following naming format: Minidump_date_time.mdp.
  • The minidump file contains the following information related to this query:
  • Catalog objects, including data types, tables, operators, and statistics required by the optimizer
  • The internal representation of the query (DXL)
    • The internal representation of the plan devised by the optimizer (DXL)
    • System configuration information passed to the optimizer, such as server configuration parameters, cost and statistics configuration, and the number of segments
    • Stack error traces generated during query optimization
  • Setting this parameter to always will generate a minidump for all queries; setting it to onerror minimizes total optimization time.
Data type Default value Value range Setting category
enum onerror onerror / always master;session;reload


What to Log

application_name


Set the application name for the client session.

  • For example, if connecting via psql, set it to psql.
  • Setting the application name allows it to be reported in log messages and statistics views.
Data type Default value Setting category
string master;session;reload

debug_pretty_print

Indented debug output produces a more readable but longer output format. - When set, debug_pretty_print indents the output generated by debug_print_parse, debug_print_rewritten, or debug_print_plan.

  • client_min_messages or log_min_messages must be DEBUG1 or lower.
  • This will result in a more readable but longer output than the "compact" mode used when the parameter is turned off.
Data Type Default Set Category
boolean on master; session; reload

debug_print_parse


For each query executed, the result analysis tree is printed out.

  • client_min_messages or log_min_messages must be DEBUG1 or lower.
Data Type Default Set Category
boolean off master; session; reload

debug_print_plan


For each executed query, print out the YMatrix parallel query execution plan.

  • client_min_messages or log_min_messages must be DEBUG1 or lower.
  • When set, the generated parse tree is printed, the query rewrite output, or the execution plan for each query executed. These information are sent at the log information level, so by default, they appear in the server log but are not sent to the client.
Data Type Default Set Category
boolean off master; session; reload

debug_print_prelim_plan


For each query executed, print out the preliminary query plan.

  • client_min_messages or log_min_messages must be DEBUG1 or lower.
Data Type Default Set Category
boolean off master; session; reload

debug_print_rewritten


For each query executed, print out the query rewrite output.

  • client_min_messages or log_min_messages must be DEBUG1 or lower.
Data Type Default Set Category
boolean off master; session; reload

debug_print_slice_table


For each query executed, print the query shard plan.

  • client_min_messages or log_min_messages must be DEBUG1 or lower.
Data Type Default Set Category
boolean off master; session; reload

gp_debug_linger


The time (in seconds) of the YMatrix process remaining after a fatal error occurs.

Data Type Default Value Value Range Set Classification
int 0 0 ~ 3600 master; session; reload

gp_log_format


Specifies the format of the server log file.

  • If using gp_toolkit management mode, the log file must be in CSV format.
Data Type Default Value Value Range Set Classification
enum csv csv / text segments; system; restart

gp_log_interconnect


Controls the amount of information written to the log file about communication between the worker processes of the YMatrix database Segment instance.

  • Log information will be written to the Master instance log and the Segment instance log.
  • Increase the amount of logging may affect performance and increase disk space usage.
Data Type Default Value Value Range Set Classification
enum terse terse / off / verbose / debug master; session; reload

gp_reraise_signal


If enabled, a core file will be generated in the event of a fatal server error.

Data Type Default Set Category
boolean off master; session; reload

log_checkpoints


Causes checkpoints and restart points to be recorded in the server log.

  • Some statistics are also included in log messages, including the data written to the buffer and the time it takes to write them.
Data Type Default Set Category
boolean off segments; system; reload

log_connections


This outputs a line to the server log, detailing each successful connection.- Only the superuser can change this parameter at the beginning of the session, in which it cannot be changed.

  • Note:Some client programs (such as psql) try to connect twice when requesting a password, so a duplicate "Received Connection" message does not necessarily indicate an error.
Data Type Default Set Category
boolean off segments; system; restart; superuser

log_disconnections


This outputs a line in the server log when the client session terminates and includes the duration of the session.

  • Only the superuser can change this parameter at the beginning of the session, in which it cannot be changed.
Data Type Default Set Category
boolean off segments; system; restart; superuser

log_dispatch_stats


When set to on, this parameter adds a log message with detailed information about statement dispatch.

Data Type Default Set Category
boolean off segments; system; restart

log_duration


The duration of each completed statement that causes the record to satisfy log_statement.

  • For clients using the extended query protocol, the duration of parsing, binding, and execution steps will be recorded independently.
  • Note:The difference between enabling log_duration and setting log_min_duration_statement to 0 is that text that exceeds log_min_duration_statement forced query is logged, but this option does not. Therefore, if log_duration is on and log_min_duration_statement is a positive value, all durations will be recorded, but only statements that exceed the threshold will be recorded in the query text. This behavior helps collect statistics in high load installations.
Data Type Default Set Category
boolean off master; session; reload; superuser

log_error_verbosity


Controls the amount of detailed information written to each recorded message in the server log.

  • Each option of this parameter adds more fields to the displayed message: terse excludes record DETAIL, HINT, QUERY, and CONTEXT error messages. The verbose messages output includes the SQLSTATE error code (see Appendix A) and the source code file name, function name, and line number that generated the error.
Data Type Default Value Value Range Set Classification
enum default terse / default / verbose messages master; session; reload; superuser

log_hostname


By default, the connection log message only displays the IP address of the connected host.

  • Turning on this parameter will cause the host name to be logged as well.
  • Note:Setting according to your hostname resolution may result in performance losses that cannot be ignored.

| Data Type | Default | Set Category | | --- | --- | --- | --- | | boolean | off | master; system; restart |

log_line_prefix


This is a printf-style string that outputs at the beginning of each log line. - % character starts "escape sequence", which will be replaced with status information as described below. Unidentified escapes are ignored.

  • Other characters are copied directly to the log line. Some escapes are only recognized by the session process and are considered as empty values ​​​​​by background processes such as the main server process.
  • Specify a number between % and this option to align the status information left or right.
  • Negative values ​​​​​ will fill the status information with spaces on the right to the minimum width, while positive values ​​​​​ will fill the status on the left. Population is very helpful for the readability of log files.
  • The default value is %m [%p], which records the timestamp and process ID.
Data Type Default Set Category
string %m [%p] segments; system; reload
Escape Effect Session Only
%a Application name Yes
%u Username Yes
%d Database name Yes
%r Remote hostname or IP address, and remote port Yes
%h Remote hostname or IP address Yes
%p Process ID No
%t No millionsecond timestamp No
%m Timestamp with million seconds No
%n Timestamp with million seconds (as Unix timestamp) No
%i Command Tag: The type of the current command in the session Yes
%e SQLSTATE Error Code No
%c Session ID: See below No
%l Log line number for each session or process, starting from 1 No
%s Timestamp for process start No
%v Virtual Transaction ID (backendID/localXID) No
%x Transaction ID (0 if not allocated) No
%q No output is generated, but tells the non-session process to stop at this point in the string; the session process ignores No
%% Plain text % No

%c escape prints a quasi-unique session identifier consisting of two 4-byte hexadecimal numbers (without leading zeros), separated by dots. These numbers are process startup time and process ID, so %c can also be used as a space to save the way these items are printed. For example, to generate a session identifier from pg_stat_activity, use this query:

SELECT to_hex(trunc(EXTRACT(EPOCH FROM backend_start))::integer) || '.' ||
       to_hex(pid)
FROM pg_stat_activity;
  • Note:If you set a non-null value for log_line_prefix, you should usually have its last character space to provide a visual difference from the rest of the log line. Punctuation marks can also be used.
  • Note:syslog generates its own timestamp and process ID information, so if you log into syslog you may not want to include those escaped information.
  • Note: %q escape is useful when including information that is only available in the context of the session (backend) (such as username or database name). For example: log_line_prefix = '%m [%p] %q%u@%d/%a '.

log_lock_waits


Controls whether a log message is to be generated when a session acquires a lock until deadlock_timeout is exceeded.

  • This helps determine whether performance is poor due to lock waiting.
  • The value of log lock waits must be greater than or equal to deadlock_timeout.
Data Type Default Set Category
boolean off segments; session; reload; superuser

log_replication_commands


Causes every [copy command] (https://www.postgresql.org/docs/12/protocol-replication.html) to be recorded in the server log.

Data Type Default Set Category
boolean off segments; session; reload; superuser

log_statement


Controls which SQL statements are recorded.

  • ddl records all data definition commands, such as CREATE, ALTER and DROP commands; mod records all DDL statements, as well as data modification statements such as INSERT, UPDATE, DELETE, TRUNCATE and COPY FROM. If the included commands are of the appropriate type, the PREPARE and EXPLAIN ANALYZE statements are also recorded; all is all statements.
  • For clients using the extended query protocol, a log is generated when an execution message is received and the value of the bound parameter is included (any embedded single quotes are written double).
  • Note: Even if you use the log_statement = all setting, statements containing simple syntax errors will not be recorded. This is because log messages are only issued after the basic syntax parsing is completed and the statement type has been determined. In the case of extended query protocols, statements that errors before the execution phase (i.e. during parsing analysis or planning) are not recorded either. This statement needs to be recorded by setting log_min_error_statement to ERROR (or lower).
Data Type Default Value Value Range Set Classification
enum none none / ddl / mod / all master; session; reload; superuser

log_temp_files


Controls records of temporary file names and sizes.

  • Temporary files can be created to sort, hash and store temporary query results.
  • If this setting is enabled, a log entry will be generated when each temporary file is deleted.
  • If this value is set to 0, it means that all temporary file information is recorded, while the positive value only records files with a size greater than or equal to the specified amount of data.
  • The default value is -1, which means logging is disabled.
Data Type Default Value Value Range Set Classification
int -1 -1 ~ INT_MAX segments; system; restart; superuser

log_timezone


Sets the time zone for the timestamp used to write to the log.

  • Unlike TimeZone, this value is system-wide, so all sessions will report timestamps consistently.
Data Type Default Set Category
string Asia/Shanghai segments; system; restart


Process Title

This section of parameters controls how the process title of the server process is modified. Process titles can usually be viewed using programs such as ps or process browser on Windows.

cluster_name

Set the name that identifies this database cluster (instance) for different purposes. This cluster name appears in the process title of all server processes in the cluster.

  • In addition, it is also the default application name for the alternate connection. (See synchronous_standby_names)
  • This name can be any string that is no longer than NAMEDATALEN characters (64 characters in standard compilation).
  • Only printable ASCII characters can be used in this parameter value. Other characters will be replaced by question marks (?).
  • If this parameter is set to the empty string '' (also the default value), the name will not be displayed.
  • This parameter can only be set when the server starts.
Data Type Default Set Category
string segments; system; restart

update_process_title


Enable process title update, and updates the process title every time the server receives a new SQL command.

  • This setting defaults to on on most platforms, but because it is more expensive to update process titles on Windows, the default is off on Windows.
Data Type Default Set Category
boolean on segments; session; reload