#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
# - Where to Log -
# log日志的格式
log_destination = 'stderr' # Valid values are combinations of
# stderr, csvlog, syslog, and eventlog,
# depending on platform. csvlog
# requires logging_collector to be on.
# This is used when logging to stderr:
# 是否收集日志
logging_collector = on # Enable capturing of stderr and csvlog
# into log files. Required to be on for
# csvlogs.
# (change requires restart)
# These are only used if logging_collector is on:
# 放log的文件夹,在PGDATA下的文件夹名称。
log_directory = 'log' # directory where log files are written,
# can be absolute or relative to PGDATA
# 日志文件名称
# log_filename = 'postgresql-%Y-%m-%d-%H.log'
log_filename = 'postgresql-%a.log' # log file name pattern,
# can include strftime() escapes
# 文件夹权限,是否有其他程序要读,如果有filebeat或者logstash可以设置成其他。一般情况下默认
#log_file_mode = 0600 # creation mode for log files,
# begin with 0 to use octal notation
# 启用时,参数将导致PostgreSQL截断(重写),而不是追加到同一名称的任何现有日志文件。
# 只有当基于时间的旋转打开新文件时,才会发生截断,而不是在服务器启动或基于大小的旋转期间发生。
log_truncate_on_rotation = on # If on, an existing log file with the
# same name as the new log file will be
# truncated rather than appended to.
# But such truncation only occurs on
# time-driven rotation, not on restarts
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.
# 启用时,此参数确定单个日志文件的最大生存期。经过了许多分钟之后,将创建一个新的日志文件。
log_rotation_age = 1d # Automatic rotation of logfiles will
# happen after that time. 0 disables.
# 启用时,确定单个日志文件的最大大小。在许多千兆字节被发送到日志文件之后,将创建一个新的日志文件。
log_rotation_size = 0 # Automatic rotation of logfiles will
# happen after that much log output.
# 0 disables.
# These are relevant when logging to syslog:
# When logging to syslog is enabled, this parameter determines the syslog “facility” to be used.
#syslog_facility = 'LOCAL0'
# 此参数确定用于在日志中标识PostgreSQL消息的程序名称
#syslog_ident = 'postgres'
# 然后每个消息将通过增加的序列号前缀。这绕过了“最后一个消息重复N次”——默认情况下许多syslog实现的抑制。在更现代的系统日志实现中,可以配置重复的消息抑制。
#syslog_sequence_numbers = on
#启用日志记录时,此参数决定如何将消息传递到系统日志。当ON(默认)时,消息由行分割,并且长行被分割,以便它们将适合1024个字节,这是传统的SysLoad实现的典型大小限制。
# 关闭时,PostgreSQL服务器日志消息按原样传递到Syslog服务,并由Syslog服务来处理可能庞大的消息。
#syslog_split_messages = on
# This is only relevant when logging to eventlog (win32):
# (change requires restart)
# 这个参数决定了用于识别消息日志PostgreSQL程序名称
#event_source = 'PostgreSQL'
# 记录日志
# - When to Log -
# 发送到客户端的消息
#client_min_messages = notice # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# log
# notice
# warning
# error
# 将哪些消息级别写入服务器日志
#log_min_messages = warning # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic
# 控制导致错误条件的SQL语句记录在服务器日志中。
#log_min_error_statement = error # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic (effectively off)
# 如果语句运行大于指定的毫秒数,则会记录每个已完成语句的持续时间。将此设置为零,打印所有语句持续时间。
#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
# and their durations, > 0 logs only
# statements running at least this number
# of milliseconds
# - What to Log -
# 这些参数允许发出各种调试输出。当设置时,它们打印生成的解析树、查询重写器输出或每个执行查询的执行计划。
# 这些消息在日志消息级别上发出,因此默认情况下它们将出现在服务器日志中,但不会发送给客户端。
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
# 日志打印自动缩进
#debug_pretty_print = on
# 日志是否记录检查点和重新启动点。
#log_checkpoints = off
# 日志是否记录连接
#log_connections = off
# 日志是否记录断开连接
#log_disconnections = off
# 记录每个完成的语句的持续时间
#log_duration = off
# 控制记录在每个日志中的服务器日志中写入的详细信息量。有效值是简洁、默认和冗长,每个都向显示的消息添加更多字段。
#log_error_verbosity = default # terse, default, or verbose messages
# 默认日志记录只打开IP,不记录hostname。开启可记录hostname
#log_hostname = off
# 日志打印格式
# '%m [%p]: [%l-1] user=%u,db=%d %h '
log_line_prefix = '%m [%p] ' # special values:
# %a = application name
# %u = user name
# %d = database name
# %r = remote host and port
# %h = remote host
# %p = process ID
# %t = timestamp without milliseconds
# %m = timestamp with milliseconds
# %n = timestamp with milliseconds (as a Unix epoch)
# %i = command tag
# %e = SQL state
# %c = session ID
# %l = session line number
# %s = session start timestamp
# %v = virtual transaction ID
# %x = transaction ID (0 if none)
# %q = stop here in non-session
# processes
# %% = '%'
# e.g. '<%u%%%d> '
# 是否记录回话的等待
#log_lock_waits = off # log lock waits >= deadlock_timeout
# 记录哪些SQL语句。
#log_statement = 'none' # none, ddl, mod, all
# 是否记录replication command
#log_replication_commands = off
# 是否记录临时文件名和大小
#log_temp_files = -1 # log temporary files equal or larger
# than the specified size in kilobytes;
# -1 disables, 0 logs all temp files
# 日志使用时区
log_timezone = 'US/Eastern'
# - Process Title -
# 设置此群集中所有服务器进程的进程标题中出现的群集名称。
#cluster_name = '' # added to process titles if nonempty
# (change requires restart)
# 设置出现在所有服务器中标题的群集名过程在这个集群。
#update_process_title = on