我在本地的 Mac 上试验将数据从 td-agent 流向 Elasticsearch 的方法,写下这个备忘录

提前准备好的事物

    • Mac に td-agent を入れておく

 

    Mac に Elasticsearch と Kibana を入れておく

安装 fluentd 的插件。

请参考以下链接 https://github.com/uken/fluent-plugin-elasticsearch,用中文原生语言来进行释义,只需一个选项的答案:

# td-agent-gem のパスは環境によって変わると思うので、調整してください。
$ sudo /opt/td-agent/usr/sbin/td-agent-gem install fluent-plugin-elasticsearch
$ sudo /opt/td-agent/usr/sbin/td-agent-gem list fluent-plugin-elasticsearch

*** LOCAL GEMS ***

fluent-plugin-elasticsearch (1.9.2)

撰写配置文件

请参考以下链接获取有关如何使用fluent-plugin-elasticsearch的信息:https://github.com/uken/fluent-plugin-elasticsearch#usage

<source>
  type forward
</source>

<source>
  type     tail
  tag      lograge
  format   json
  path     /Users/mochizuki/Developments/project/log/lograge_development.log
  pos_file /Users/mochizuki/Developments/project/log/lograge_development.log.pos
  time_key time
</source>

<match lograge>
  @type copy
  <store>
    @type stdout
  </store>
  <store>
    @type elasticsearch
    host localhost
    port 9200
    index_name fluentd
    type_name fluentd
  </store>
</match>

尝试启动和运行Elasticsearch与Kibana。

请参考这个网址(https://www.elastic.co/jp/videos/getting-started-elasticsearch),来了解如何快速入门 Elasticsearch。

有关启动的详细信息请参考上方视频。

我会从Kibana的开发工具中进行确认。

スクリーンショット 2017-02-20 15.36.03.png

一切平安無事,任務完畢。

非常感谢您。

广告
将在 10 秒后关闭
bannerAds