【PostgreSQL-9.6.3】设置log参数
来源:互联网 发布:windows启动过程 编辑:程序博客网 时间:2024/05/21 09:30
编辑数据目录中的postgresql.conf参数文件,我的数据目录是/usr/local/pgsql/data
vi postgresql.conf
找到如下内容:
...
#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
# - Where to 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 = off # 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_directory = 'pg_log' # directory where log files are written,
# can be absolute or relative to PGDATA
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
# can include strftime() escapes
#log_file_mode = 0600 # creation mode for log files,
# begin with 0 to use octal notation
#log_truncate_on_rotation = off # If on, an existing log file with the
#log_rotation_age = 1d # Automatic rotation of logfiles will
# happen after that time. 0 disables.
#log_rotation_size = 10MB # Automatic rotation of logfiles will
...
日志收集功能在大部分情况下是需要打开的,所以设置为:
logging_collector = on
日志目录可以使用默认目录,也可以自行修改,一般选择默认目录就可以了:
log_directory = 'pg_log'
日志文件模式,一般选择默认就可以:
log_file_mode = 0600
日志保存周期及切换方式可以采用如下几种方案:
(1)每天生成新的日志文件
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = off
log_rotation_age = 1d
log_rotation_size = 0
(2)每当日志文件满10M时,进行切换
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = off
log_rotation_age = 0
(3)日志保存周期为7天,循环覆盖
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = on
log_rotation_age = 1d
- 【PostgreSQL-9.6.3】设置log参数
- 【PostgreSQL-9.6.3】LOG: unrecognized configuration parameter "dynamic_shared_memory_type"
- 【PostgreSQL-9.6.3】设置非自动提交
- Postgresql相关的内存设置参数
- Postgresql相关的内存设置参数
- PostgreSQL View current log
- PostgreSQL log配置
- PostgreSQL性能调优:设置适当的系统参数
- 【PostgreSQL-9.6.3】约束
- 【PostgreSQL-9.6.3】分区表
- 【PostgreSQL-9.6.3】使用pg_settings表查看参数的生效条件
- postgresql 参数注释
- postgresql standard_conforming_strings参数
- postgresql.conf参数-备查
- postgresql 加载参数文件
- postgresql参数synchronous_commit详解
- postgresql参数full_page_writes详解
- postgresql参数wal_level
- vue--mounted
- java中IO流中的标准输入输出流
- 前端知识点整理系列(二)—— apply() call() bind()
- java中IO流中的转换流
- 图标切换,内容展开
- 【PostgreSQL-9.6.3】设置log参数
- ARGB与RGB、RGBA的区别
- Torch SpatialZeroPadding 实例
- Java基础练习项目-猜字母小游戏
- 正则化
- java中IO流中的 打印流
- 染色 HYSBZ
- Mosquitto搭建Android推送服务(三)Mosquitto集群搭建
- 78 C语言函数的递归调用