暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL pgloggingfilter csvlog log 日志过滤器

digoal 2020-03-26
464

作者

digoal

日期

2020-03-26

标签

PostgreSQL , pgloggingfilter , 日志过滤


背景

根据日志等级, 错误代码过滤日志打印. 用处挺多, 例如你不想打印一些业务代码的错误, 比如pk冲突, 约束冲突等.

pgloggingfilter

pgloggingfilter is a filter module for PostgreSQL logging. It can be used
to suppress logging of various expected errors which is especially useful in
cases where users are allowed to call stored procedures with potentially
invalid arguments.

To enable pgloggingfilter it needs to be included in postgresql.conf's
shared_preload_libraries list after which control minimum error levels for
logging per sqlstate using the two new GUCs, for example:

pgloggingfilter.log_min_messages_by_sqlstate = '22012:PANIC'
pgloggingfilter.log_min_error_statement_by_sqlstate = 'P0001:PANIC,23503:PANIC'

would set the minimum error level for logging division by zero errors to
PANIC essentially disabling their logging and also prevent statements
causing PL/pgSQL 'RAISE EXCEPTION' and foreign key violations from being
logged.

Note that this module can only increase the minimum error level from the
base values set with log_min_messages and log_min_error_statement - i.e.
if statement logging is not globally enabled this module can't enable it
for any SQLSTATEs.

See http://www.postgresql.org/docs/devel/static/errcodes-appendix.html for
the list of SQLSTATEs.

This was originally proposed as a core feature, see
https://commitfest.postgresql.org/action/patch_view?id=1360

license

pgloggingfilter is released under the Apache License, Version 2.0.

For the exact license terms, see LICENSE and
http://opensource.org/licenses/Apache-2.0 .

contact

pgloggingfilter is maintained by Ohmu Ltd hackers opensource@ohmu.fi, bug
reports and patches are very welcome, please post them as GitHub issues and
pull requests at https://github.com/ohmu/pgloggingfilter

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论