在linux上转发linux日志到fluentd

在一个虚拟机上,我在/etc/rsyslog.d/50-default.conf有这个

 *.* @192.168.29.1:42185 # Default rules for rsyslog. 

在stream利的虚拟机上,我有这样的:

我在/etc/td-agent/td-agent.conf有这个

 <source> type syslog port 42185 tag rsyslog </source> <match rsyslog.**> type copy <store> # for debug (see /var/log/td-agent.log) type stdout </store> <store> type elasticsearch logstash_format true flush_interval 10s # for testing. </store> </match> 

但似乎没有任何东西发送到远程机器,因为我在/var/log/td-agent.log查看,我看到

 2014-08-08 10:51:10 -0700 [info]: adding source type="syslog" 2014-08-08 10:51:10 -0700 [info]: adding source type="forward" 2014-08-08 10:51:10 -0700 [info]: adding source type="http" 2014-08-08 10:51:10 -0700 [info]: adding source type="debug_agent" 2014-08-08 10:51:10 -0700 [info]: adding match pattern="td.*.*" type="tdlog" 2014-08-08 10:51:10 -0700 [info]: adding match pattern="debug.**" type="stdout" 2014-08-08 10:51:10 -0700 [info]: adding match pattern="rsyslog.**" type="copy" 2014-08-08 10:51:10 -0700 [info]: listening fluent socket on 0.0.0.0:24224 2014-08-08 10:51:10 -0700 [info]: listening dRuby uri="druby://127.0.0.1:24230" object="Engine" 2 

我不知道为什么日志没有被发送,我不知道如何判断rsyslog是否有问题,而不是发送文件。

如果我没有弄错,rsyslog通过TCP转发日志(在configuration文件中,这被列为“for reliability”),但是fluentD的监听器默认侦听UDP。 这个改变你的fluentDconfiguration应该允许你接收TCP上的日志:

 <source> type syslog port 42185 protocol_type tcp tag rsyslog </source> 

如果在进行此更改后仍未收到日志,我将检查TCP转储是否正在接收代理上的stream量:

 tcpdump -i any port 42185 

这也应该表明是否正在接收TCP或UDP(仅指定port ,而不是tcpudp

编辑:除此之外,请确保您的rsyslogconfiguration是正确的:所有我见过和使用的例子,在前进的规则中有一个双@@

 *.* @@192.168.29.1:42185 

http://www.rsyslog.com/doc/rsyslog_reliable_forwarding.html