似てる #fluentd プラグインの比較
これはウィークリーFluentdユースケースエントリリレーの参加エントリです。
@oranieさんによるまとめエントリはこちら
Fluentdのプラグインって沢山ありますよね?
その中から、似てるものを見つけて違いが気になったので調べてみました。
・fluent-plugin-rewrite
by @kentaroさん
fluent-plugin-rewriteというプラグインを作成した #fluentd
・fluent-plugin-rewrite-tag-filter
by @yoshi_kenさん
自在にタグを書き換える fluent-plugin-rewrite-tag-filter でログ解析が捗るお話 #fluentd
今回は、@studio3104さんのこちらのブログエントリを元に構成を作りました。
fluent-plugin-rewriteを使用されています。
素晴らしいエントリありがとうございます!
今回の比較とは関係ないのですが、HTTPステータスコードのカウントを取ってみたかったので、
fluent-plugin-datacounterの設定を追加しています。
・送信側の設定例
・受信側の設定例
これで、GrowthForecastにこんなグラフが出力できます。
※host01.top.mixという複合グラフは手で作りました。



で、fluent-plugin-rewrite-tag-filter版がこちら。
https://gist.github.com/4078096
・2つの設定ファイルのdiffはこちら。
https://gist.github.com/4078402
グラフはこちら
※top.mixという複合グラフは手で作りました。



2つのプラグインの違いのまとめ
・fluent-plugin-rewrite
マッチした文字列自体や書き換えを行った文字列を、
渡ってきた元のタグに付加して新しいタグとして再emit。
・fluent-plugin-rewrite-tag-filter
マッチした文字列自体や書き換えを行った文字列を、
新しいタグとして再emit。
※今日時点のバージョン(v1.0.0)では、渡ってきた元のタグを残す事が出来ない。
(上記の例で言うと、host01という文字列です)
という違いになります。
fluent-plugin-rewrite-tag-filterの場合、
送信側でタグにホスト名を含めておいて、
グラフをホスト別に出力するという事が出来ない気がします。
それ以外は全く同じ事が出来るので、どちらを使うかはお好みでよろしいかと思います!!
間違いなどあれば、ご指摘ください。
2012/11/17 追記
fluent-plugin-rewrite-tag-filterの作者である@yoshi_kenさんからご連絡いただき、
早速機能追加していただきました。ありがとうございます!