【发布时间】:2009-09-16 15:27:06
【问题描述】:
我在我的 Postgres 数据库中启用了日志记录(在 Ubuntu 32 位上运行),我想只记录用户应用程序重新执行的查询。我已将 postgres 配置如下:
log_destination = 'syslog'
syslog_facility = 'L*emphasized text*OCAL0'
syslog_ident = 'postgres'
log_min_messages = notice
log_min_duration_statement = 0
log_duration = off
log_line_prefix = 'user=%u,db=%d '
log_statement = 'none'
在syslog.conf 中,我已经为每个发送到local0 的日志配置了重定向到/var/log/pgsql。
但是,Postgres 记录了很多我不关心的查询,例如:
WHEN typbasetype=0 THEN oid else typbasetype END AS
Sep 16 12:22:28 or-ubuntu postgres[14086]: [11-2] basetype
Sep 16 12:22:28 or-ubuntu postgres[14086]: [11-3] ^I FROM pg_type WHERE oid=1043
Sep 16 12:22:28 or-ubuntu postgres[14086]: [12-1] user=postgres,db=prueba LOG: duración: 0.361 ms sentencia: SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 2950
Sep 16 12:22:28 or-ubuntu postgres[14086]: [13-1] user=postgres,db=prueba LOG: duración: 0.348 ms sentencia: SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS
Sep 16 12:22:28 or-ubuntu postgres[14086]: [13-2] basetype
Sep 16 12:22:28 or-ubuntu postgres[14086]: [13-3] ^I FROM pg_type WHERE oid=2950
Sep 16 12:22:28 or-ubuntu postgres[14086]: [14-1] user=postgres,db=prueba LOG: duración: 0.451 ms sentencia: SELECT format_type(oid,104) as typname FROM pg_type WHERE oid =
Sep 16 12:22:28 or-ubuntu postgres[14086]: [14-2] 1043
Sep 16 12:22:28 or-ubuntu postgres[14086]: [15-1] user=postgres,db=prueba LOG: duración: 0.353 ms sentencia: SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS
Sep 16 12:22:28 or-ubuntu postgres[14086]: [15-2] basetype
Sep 16 12:22:28 or-ubuntu postgres[14086]: [15-3] ^I FROM pg_type WHERE oid=1043
有什么方法可以防止这些行被记录吗?
提前致谢
迭戈
【问题讨论】:
标签: postgresql logging