Skip to content

Instantly share code, notes, and snippets.

@kogoto
Last active August 29, 2015 14:24
Show Gist options
  • Save kogoto/1cec2a5c701e778d55da to your computer and use it in GitHub Desktop.
Save kogoto/1cec2a5c701e778d55da to your computer and use it in GitHub Desktop.
Fluentdのインストール

Fluentd

Ruby Gemバージョン

##インストール

$ gem install fluentd --no-document

初期設定

$ fluentd --setup ./fluent

起動

$ fluentd -c ./fluent/fluent.conf -vv &

rpmバージョン(CentOS and RHEL 5, 6 and 7)

インストール

$ 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

命令一覧

  1. source 入力元の設定
  2. match 出力先の設定
  3. filter イベント処理パイプラインの設定
  4. system システム全体の設定
  5. @include 他ファイルのインクルード設定

source, match

sourceにはログを取得するためのプラグインを指定します。
matchにはsource同様にプラグインやログを取得するファイルパターン等を指定します。

利用可能なプラグイン

<source>
  type http
  port 8888
</source>

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

これにより例えばhttpのポート8888、debug.testへのアクセスログが標準出力に出力されます。
(実行テストのhttp://localhost:8888/debug.testへのアクセス)

filter

system

@include

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment