LoginSignup
2
6

More than 5 years have passed since last update.

td-agent から Elasticsearch にデータを流す。というのをローカル Mac で試す自分用メモ。

Last updated at Posted at 2017-02-20

事前に用意しておくもの

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

fluentd のプラグインを入れる

ref. 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)

設定ファイルを書く

ref. https://github.com/uken/fluent-plugin-elasticsearch#usage

/etc/td-agent/td-agent.conf
<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 を立ち上げて動かしてみる

ref. https://www.elastic.co/jp/videos/getting-started-elasticsearch

起動については、上動画に詳しく書かれてあります。

Kibana の Dev Tools から、確認してみます。

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

無事、終了でございます。

ありがとうございました。

2
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
6