日志轮换导致 nxlog 失败

日志轮换导致 nxlog 失败

我正在使用 nxlog 查看 Windows Server 2008 系统上的两个 vCenter 日志文件,并且我有一个非常简单的配置来将消息发送到 Logstash。昨天在文件轮换后,Nxlog 开始出现故障。这是我的配置:

<Extension syslog>
    Module      xm_syslog
</Extension>

<Input in1>
    Module      im_file
    File        "C:\ProgramData\VMware\VMware VirtualCenter\Logs\vpxd-[0-5][0-9].log"
    SavePos     TRUE
</Input>

<Input in2>
    Module      im_file
    File        "C:\ProgramData\VMware\VMware VirtualCenter\Logs\vpxd-alert-[0-5][0-9].log"
    SavePos     TRUE
</Input>

<Processor buffer1>
    Module  pm_buffer
    MaxSize 1024
    Type    Mem
    WarnLimit   512
</Processor>

<Processor buffer2>
    Module  pm_buffer
    MaxSize 1024
    Type    Mem
    WarnLimit   512
</Processor>

<Output out1>
    Module      om_udp
    Host        <ip>
    Port        514
</Output>

<Output out2>
    Module      om_udp
    Host        <ip>
    Port        514
</Output>

<Route 1>
    Path        in1 => buffer1 => out1
</Route>

<Route 2>
    Path        in2 => buffer2 => out2
</Route>

vCenter 日志轮换有点奇怪,所以我认为这至少部分导致了这个问题。您可以从上方看到我正在观察的文件名。此文件创建为 vpxd-01.log 并从那里递增。当文件达到 50MB 时会轮换,并且在创建两个新文件后会压缩旧日志,例如创建 vpxd-03 并压缩 vpxd-01。

但是昨天,nxlog 开始监视的第一个文件(自上周安装以来)被旋转了,导致了这个错误:

2013-12-28 19:41:08 WARNING input file does not exist: C:\ProgramData\VMware\VMware VirtualCenter\Logs\vpxd-47.log

它在接下来的 24 小时内重复了 12 次,然后 nxlog 完全失败,直到昨天早上我重新启动服务。

希望我的解释有意义。我最终丢失了大约六个小时的日志,所以我想确保这种情况不会再次发生。有人有什么解决方案或建议吗?

答案1

尝试使用此输入,而不是硬定义 [0-5][0-9]:

<Input in2>
    Module      im_file
    File        "C:\ProgramData\VMware\VMware VirtualCenter\Logs\vpxd-*.log"
    SavePos     TRUE
</Input>

相关内容