LoginSignup
1
1

More than 5 years have passed since last update.

fluentdからrtailにログを送る

Posted at

rtailというリモートサーバからログを受信してまとめて表示するCloudWatch LogsのようなOSSがありまして、クライアントのソースコードを読んだところUDPでメッセージを送っているだけだったので、fluentdのプラグインを書いてみました。

winebarrel/fluent-plugin-rtail: Fluentd output plugin for rtail.

インストール

gem install fluent-plugin-rtail

動かしてみる

rtail-serverを起動して、localhost:8888にアクセスします。

rtail-server

fluentdを以下のような設定で起動します。

<source>
  @type forward
  @id forward_input
  @label @forward_input
</source>

<label @forward_input>
  <match **>
    @type rtail
    flush_interval 0s
  </match>
</label>

fluentdにログを投げます。

echo '{"id":"foo","content":"Zzz.."}' | fluent-cat -t rtail.data

rtailのほうで、fooというストリームが作成されて、fluentdから送られてきたログが表示されます。

スクリーンショット 2016-12-25 16.38.02.png

そのた

  • use_tag_as_id: trueとすると、タグをストリームIDにします
  • use_record_as_content: trueとすると、フィールドの値ではなくレコードそのものをrtailに送信します(rtailはJSONを構造化されたデータとして扱います)

どうぞご利用ください。
メリークリスマス

1
1
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
1
1