fluentdインストールと簡単な使い方
fluentdのdocumentはこちら
http://docs.fluentd.org/articles/quickstart
インストール
インストール前の以下の確認が必要。
- NTPの設定(ntpdのセットアップ)
時間は大事。
ulimit -n
の確認
1024では不十分とのこと。65535まではあげて、とのこと。
/etc/sysctl.conf
の確認
複数のfluentdインスタンスがたち、高負荷になることを想定するなら以下の設定を追加。
net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.ip_local_port_range = 10240 65535
インストールは以下のスクリプトで行うのが、簡単だと思う。
$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh
これより以下は上記でインストールした場合を想定。
- 起動(スクリプトの実行)
$ sudo /etc/init.d/td-agent start
サポートしているコマンドは'start', 'stop', 'restart', 'status'
。
設定
設定ファイルは/etc/td-agent/td-agent.conf
。
設定はviで行う。以下のディレティブがある。
source directives determine the input sources. match directives determine the output destinations. filter directives determine the event processing pipelines. system directives set system wide configuration. label directives group the output and filter for internal routing @include directives include other files.
- プラグインの導入
$ /usr/sbin/td-agent-gem install <plugin name>
様々なプラグイン
工事中。。。