##インストール
$ gem install fluentd --no-document
$ fluentd --setup ./fluent
$ fluentd -c ./fluent/fluent.conf -vv &
$ curl -L https://td-toolbelt.herokuapp.com/sh/install-redhat-td-agent2.sh | sh
$ /etc/init.d/td-agent start (systemctl start td-agent)
※gem版は起動スクリプトがないので自前で用意する必要がある
$ curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
ログが出力されることを確認できればOK。
rpm版の場合 /etc/td-agent/td-agent.conf
- source 入力元の設定
- match 出力先の設定
- filter イベント処理パイプラインの設定
- system システム全体の設定
- @include 他ファイルのインクルード設定
sourceにはログを取得するためのプラグインを指定します。
matchにはsource同様にプラグインやログを取得するファイルパターン等を指定します。
<source>
type http
port 8888
</source>
<match debug.**>
type stdout
</match>
これにより例えばhttpのポート8888、debug.testへのアクセスログが標準出力に出力されます。
(実行テストのhttp://localhost:8888/debug.testへのアクセス)