【问题标题】:convert rsyslog message format when forwarding messages with structured-data转发带有结构化数据的消息时转换 rsyslog 消息格式
【发布时间】:2015-07-28 01:40:20
【问题描述】:

我的守护进程使用 libc syslog() 调用以 RSYSLOG_TraditionalFileFormat 格式记录消息。并且,运行在同一主机上的 rsyslogd 守护进程需要将所有这些消息以RSYSLOG_SyslogProtocol23Format 格式转发到远程日志收集器。

现在我想将%STRUCTURED-DATA%“搭载”到RSYSLOG_TraditionalFileFormat 格式(基本上,当我的守护进程调用syslog() 时,它会在方括号中指定结构化数据)。 如何在 rsyslog.conf 中指定传入的日志消息格式(或模板),以便它能够理解结构化数据?

我了解其中一种解决方案是让我的守护程序直接向/dev/log 发送消息并更改rsyslog.conf 中的默认日志消息格式。但是,这似乎不对,因为我想保持本地日志格式相同。

【问题讨论】:

    标签: linux logging syslog rsyslog


    【解决方案1】:

    似乎无法优雅地解决这个问题,因为 libc syslog() 调用使用了/dev/log UNIX 域套接字。

    并且 rsyslog 8.8 和更早版本使用硬编码消息解析器来处理通过 UNIX 域套接字接收的消息。请参阅 usespecialparser 设置 (http://www.rsyslog.com/doc/v8-stable/configuration/modules/imuxsock.html)

    另一个让它与 rsyslog 7.4 附带的最新 Ubuntu 15.04 一起工作的选择是使用 UDP 套接字,但是我不能再使用 libc syslog()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-18
      • 2015-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-06
      相关资源
      最近更新 更多