Ubuntu 11.04 中的 rsyslogd 忽略了 conf 文件中的行?

Ubuntu 11.04 中的 rsyslogd 忽略了 conf 文件中的行?

不久前,我发布了这个问题,并得到了一个在 Ubuntu 10.10 和 Linux Mint 10 中完美运行的答案。它所做的就是在内核消息发生时将其发送给脚本。在我的例子中,它重定向到一个脚本,该脚本将内核消息发布到我的笔记本电脑的 OLED 屏幕上。我通过将以下几行添加到我的 /etc/rsyslog.conf 文件来实现这一点:

$template OLEDformat,"%msg%0
kern.*  ^/opt/asusg50oled/utils/notify.sh;OLEDformat

后来,我将 rsyslog.conf 文件恢复正常,并将上述几行移至新文件 /etc/rsyslog.d/00-asusg50oled.conf,以便在需要时更轻松地进行调整。由于 /etc/rsyslog.conf 无论如何都会从 /etc/rsyslog.d 加载所有内容,因此这种方法同样有效。

但问题是,这在 Ubuntu 11.04 和 Linux Mint 11 RC 中不再有效。无论我将行放在 /etc/rsyslog.conf 中还是 /etc/rsyslog.d/ 中的文件中,在 rsyslog 启动时,我只会收到一条转发的消息。检查 /etc/rsyslog.conf 中已引用的文件显示系统正在记录内核事件,并且dmesg工作正常。

Ubuntu 10.10 和 11.04 之间的 rsyslog 有什么变化吗?有没有解决方法?

编辑

以下是 Linux Mint 11 RC 和 Ubuntu 11.04 上的输出rsyslogd -v,上述解决方案不起作用:

rsyslogd 4.6.4, compiled with:
    FEATURE_REGEXP:             Yes
    FEATURE_LARGEFILE:          No
    FEATURE_NETZIP (message compression):   Yes
    GSSAPI Kerberos 6 support:      Yes
    FEATURE_DEBUG (debug build, slow code): No
    Atomic operations supported:        Yes
    Runtime Instrumentation (slow code):    No

这是 Linux Mint 10 和 Ubuntu 10.10 上的输出rsyslogd -v,上述解决方案运行完美:

rsyslogd 4.2.0, compiled with:
    FEATURE_REGEXP:             Yes
    FEATURE_LARGEFILE:          Yes
    FEATURE_NETZIP (message compression):   Yes
    GSSAPI Kerberos 5 support:      Yes
    FEATURE_DEBUG (debug build, slow code): No
    Atomic operations supported:        Yes
    Runtime Instrumentation (slow code):    No

根据www.rsyslog.com,rsyslogd 的最新稳定版本实际上是 5.8.1,目前似乎无法作为 Ubuntu 11.04 或 Linux Mint 11RC 的更新使用。

编辑2

我刚刚验证了 openSUSE 11.4 是否正确遵循了我为 rsyslogd 添加的配置行。在 openSUSE 11.4 中,输出rsyslogd -v如下:

rsyslogd 5.6.5, compiled with:
    FEATURE_REGEXP:             Yes
    FEATURE_LARGEFILE:          No
    FEATURE_NETZIP (message compression):   Yes
    GSSAPI Kerberos 5 support:      Yes
    FEATURE_DEBUG (debug build, slow code): No
    Atomic operations supported:        Yes
    Runtime Instrumentation (slow code):    No

遗憾的是,我发现自己并不喜欢 openSUSE,所以我将回到 Linux Mint,但我仍然遇到问题。我现在想知道内核中是否可能存在一些不同之处(称之为预感)。有什么想法吗?

更新

我刚刚从源代码构建并安装了 rsyslogd 5.8.1(最新稳定版本)。我可以确认它安装正确,因为转发的唯一消息反映了新版本号。此外,rsyslogd -v 输出:

rsyslogd 5.8.1, compiled with:
    FEATURE_REGEXP:             Yes
    FEATURE_LARGEFILE:          No
    GSSAPI Kerberos 5 support:      No
    FEATURE_DEBUG (debug build, slow code): No
    32bit Atomic operations supported:  Yes
    64bit Atomic operations supported:  No
    Runtime Instrumentation (slow code):    No

答案1

在我看来,rsyslog 本身似乎存在一个错误(可能已在后续版本中修复)。4.6.5 的变更日志说明提到了“imfile”模块的几个错误修复,这些错误可能适用,也可能不适用。所以就是这样。

Scott Moser 也有一个可用的 PPA,其中包括 rsyslog 版本 5.8.1,您可以在这里找到,如果您不介意使用该存储库的话。

另一个想法是,如果您当前使用的是 32 位 Ubuntu,则可以考虑使用 64 位版本。Changelog 注释提到了这样做产生的一些错误。不太可能有帮助,因为这似乎与架构无关,但这是一个想法。

相关内容