日志收集器fluentd:配置forward从客户机到收集入库端

转载请声明出处:http://blackwing.iteye.com/blog/2152319

试用了fluentd,挺方便易用,支持直接到hdfs,hbase,mangoDB等,可以跟已有业务结合。
安装fluentd非常简单,官方教材地址:[url]http://docs.fluentd.org/categories/installation[/url]

以下是针对ubuntu 12.04 LTS进行说明:
1.先修改系统环境,例如增加open files数目、修改网络参数等:[url]http://docs.fluentd.org/articles/before-install[/url]

2.根据自己系统版本,直接执行官方写好的一键安装脚本:
curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-precise-td-agent2.sh | sh


安装好后,个文件路径为:
1)配置文件:/etc/td-agent/td-agent.conf
2)起停脚本:/etc/init.d/td-agent start|stop|restart|status
3)默认log路径:/var/log/td-agent/td-agent.log

应用场景是:收集其他部门某应用的log,发回到本部门服务器,并入库到hdfs。所以需要在某部门服务器上,安装fluentd用于把日志forward到本地服务。

借用官方图解:
[img]http://docs.fluentd.org/images/fluentd_ha.png[/img]

官方的配置可以参考高可用部分的配置:[url]http://docs.fluentd.org/articles/high-availability[/url]

大概配置如下:
forward端的配置:
<source>
type forward
port 24224
</source>

# Log Forwarding
<match testforward.**>
type forward
host 172.19.99.176
flush_interval 10s
</match>


聚集端的配置:
<source>
type forward
port 24224
</source>

<match testforward.*>
type webhdfs
host namenode
port 50070
path /log/%Y%m%d_%H/access.log.${hostname}
flush_interval 10s
</match>



但官方没有详细说明,导致配置后fluentd不能启动,其实原来的td-agent.conf配置文件已经有以下配置:

<source>
type forward
</source>


所以,会有两个forward的source,导致fluentd启动失败,报错说端口24224已经在使用,解决办法是删掉以上默认配置就行。


现在可以测试curl一条信息到forward机器,它就会直接把细心转发到聚集机器,并且自动入库到hdfs。

另外,关于其他日志收集工具,请看董西成的blog:[url]http://dongxicheng.org/search-engine/log-systems/[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值