生成格式良好的RFC5424系统日志协议消息的日志格式化程序

syslog-rfc5424-formatter的Python项目详细描述


这个模块实现了一个pythonlogging格式化程序,它向给定的套接字生成格式良好的rfc5424兼容的syslog消息。

Build StatusPyPI versionDocumentation Status

用法

如果您是从代码配置记录器,则应按如下方式使用此格式化程序:

importloggingimportlogging.handlersfromsyslog_rfc5424_formatterimportRFC5424Formatterdefset_up_logging():h=logging.handlers.SysLogHandler('/path/to/syslog_socket')h.setFormatter(RFC5424Formatter())logging.getLogger('').addHandler(h)

如果您使用的是json/yaml配置文件和logging.config.dictConfig的更现代的组合,那么您的配置文件应该如下所示(假设yaml有具体的语法):

formatters:syslog:():syslog_rfc5424_formatter.RFC5424Formatterhandlers:syslog:formatter:syslogclass:logging.handlers.SysLogHandleraddress:"/path/to/syslog/socket"facility:"ext://logging.handlers.SysLogHandler.LOG_USER"root:level:INFOhandlers:-syslog

许可证

这项工作是在isc许可下授权的,其文本可以在LICENSE.txt找到。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java无法启动发现(Android附近连接API v2)   如何用Java在Firestore中创建嵌套字段?   GUI Java中的swing BMI计算器;   java如何检查上下文是否为当前正在运行的活动   LiveCycle ES4支持java 8吗?   构建Spring引导API后,java类路径不正确   启动时swing Java Jtable行颜色   JAVAutil。ConcurrentModificationException随着Apache Tomee Plus 7.1.2的发布启动ear文件   在JAVA中使用lambda表达式的foreach for循环   java小程序没有在我的IE8和firefox6中运行。0.2   java有没有比ConcurrentHashMap性能更好的并发映射?   java Android静态与非静态问题   尝试提交TableCell时调用java cancelEdit()   java在LINUX系统上使用MCRTsim模拟器   Java多态性方法重写