hgdb运行日志保存周期配置详解

📅 2026/7/11 22:23:30 👁️ 阅读次数 📝 编程学习
hgdb运行日志保存周期配置详解

文章目录

  • 环境
  • 文档用途
  • 详细信息

环境

系统平台:银河麒麟 (鲲鹏)
版本:9.0.1,6.0,4.5.10

文档用途

本文主要用于介绍hgdb运行日志配置项,工程师可根据客户需要进行保存策略的设置

详细信息

1、数据库运行日志保存策略相关参数如下:

logging_collector = 'on' #开启数据库运行日志记录 log_directory = '/hgdata/highgo/hgdb_log' #数据库日志配置为数据库data目录以外的路径,也可设置为../hgdb_log log_filename = 'highgodb_%d.log' #保留一个月日志,循环覆盖 log_rotation_age = '1d' #每天生成一个新的日志文件 log_rotation_size = '0' #不限制单个日志文件大小 log_truncate_on_rotation = 'on' #覆盖同名文件

2、日志保存周期参数log_filename的补充介绍

log_filename参数默认是postgresql-%Y-%m-%d_%H%M%S.log,默认为永久保留,以下是详解介绍 ① %d 保存一月 -rw-------. 1 highgo highgo 410 May 26 15:52 postgresql-26.log ② %d_%H 每小时生成一个 -rw-------. 1 highgo highgo 410 May 26 15:54 postgresql-26_15.log ③ %a 保存一周 英文显示 -rw-------. 1 highgo highgo 968 May 26 15:46 postgresql-Tue.log ④ %u 保存一周 数字显示 -rw-------. 1 highgo highgo 410 May 26 15:46 postgresql-2.log ⑤ %m 保存一年 每月一个 -rw-------. 1 highgo highgo 410 May 26 15:49 postgresql-05.log ⑥ %m-%d 保存一年 每天一个 -rw-------. 1 highgo highgo 410 May 26 15:51 postgresql-05-26.log