LoginSignup
6
4

More than 5 years have passed since last update.

馴染みあるツールで fluentd に対してお手軽にメトリクスを送信する

Posted at

fluentd のアグリゲータサーバを建てたのはいいけど、アプリからログ送信開始後に疎通不能が発覚するなどという出戻りを防ぐために、実利用開始前にとりあえずインフラ的に疎通確認しておきたい。

ログ送信元のアプリサーバに fluent-cat が入っていなかったり、別途専用クライアントを用意する手間も省きたい場合にはよく telnet や ncat で代用している。

fluentd

下記のような設定で fluent-dst.cie.la というサーバ上の 24224 ポートで起動済みのものとする。

<source>
  type forward
</source>

<match debug.**>
  type stdout
</match>

このサーバに debug.ciela.test というタグで ["a","b",{"first":"one","second":"two"}] という JSON データを送りたい。

telnet

[ciela@fluent-src ~]$ telnet fluent-dst.cie.la 24224
Trying 10.100.100.100...
Connected to fluent-dst.cie.la.
Escape character is '^]'.
["debug.ciela.test",1459845632,["a","b",{"first":"one","second":"two"}]]

時刻は date +%s した結果でも利用しておくといいかと思う。

ncat

[ciela@fluent-src ~]$ echo '["debug.ciela.test",1459845632,["a","b",{"first":"one","second":"two"}]]' | ncat fluent-dst.cie.la 24224

時刻は(ry

確認

上記2つともアグリゲータサーバのログにこんな感じで吐かれていればOK。

2016-04-05 17:40:32 +0900 debug.ciela.test: ["a","b",{"first":"one","second":"two"}]
6
4
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
6
4