我们在进行fluentd,elasticsearch,kibana环境搭建时,fluentd需要es作为存储的平台,这个时候在配置vi /etc/td-agent/td-agent.conf时
- <match task.**>
- host 192.168.0.1 ##### elasticsearch 服务器地址
- type elasticsearch
- logstash_format true
- flush_interval 5s
- include_tag_key true
- tag_key mapred
- </match>
中间涉及到使用elasticsearch,所以我们要安装
fluent-plugin-elasticsearch
/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch
发生错误:
ERROR: Error installing fluent-plugin-elasticsearch: ERROR: Failed to build gem native extension. /usr/lib64/fluent/ruby/bin/ruby extconf.rb checking for curl-config... no checking for main() in -lcurl... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/lib64/fluent/ruby/bin/ruby --with-curl-dir --without-curl-dir --with-curl-include --without-curl-include=${curl-dir}/include --with-curl-lib --without-curl-lib=${curl-dir}/lib --with-curllib --without-curllib extconf.rb:39:in `<main>': Can't find libcurl or curl/curl.h (RuntimeError)
这个是由于我们没有安装 libcurl-devel造成的,我们只要先yum install libcurl-devel,再次重新
/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch时就可以顺利进行下去。
如此,fluentd配置成功,可以启动了service td-agent start