LoginSignup
9
8

More than 5 years have passed since last update.

windowsにfluentdをインストールする手順

Posted at

概要

  • windowsにfluentdをインストールする手順です。
  • rubyがバンドルされたtd-agentという形で提供されてるlinuxに入れる場合と比べて面倒です。

参考

環境

  • Windows10 Proエディション(64bit)
  • Ruby 2.2.4 (x64)
  • fluentd v12

インストール手順

Rubyをインストール

  • ダウンロードURL http://rubyinstaller.org/downloads/

    • rubyinstaller-2.2.4-x64.exe
    • DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
  • rubyinstaller-2.2.4-x64.exeを実行

    • 「Rubyの実行ファイルへ環境変数PATHを追加する」にチェック
  • DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exeを実行

    • 解凍先は、C:\rubydevkitを指定
    • コマンドプロンプトを起動してコマンドを実行
cd C:\rubydevkit
ruby dk.rb init
ruby dk.rb install

gitをインストール

  • 既に入っていれば不要。(gitのインストール手順は省略)

fluentdをインストール

cd C:\Temp
git clone https://github.com/fluent/fluentd.git
cd fluentd
git checkout windows
gem install bundler
bundle
bundle exec rake build
# fluentd 0.12.15 built to pkg/fluentd-0.12.15.gem.
# pkg配下にgemが作られるのでそれを指定してインストール
gem install pkg\fluentd-0.12.15.gem --no-ri --no-rdoc

その他

# fluentdの実行ファイル
C:\Ruby23-x64\bin\td-agent

動作確認

内容

  • 入力(Input Plugin)として、in_exec(HOSTNAMEコマンド実行)
  • 出力(Output Plugin)として、out_stdout(ログファイルに出力されます)

手順

  • C:\Temp\fluentd\fluent.confを編集
    • keysは
    • タグ名は、なんでも良いがここでは、info.win
    • コマンドの実行間隔は10秒
<source>
  @type exec
  format tsv
  command HOSTNAME
  keys hostName
  tag info.win
  run_interval 10s
</source>

<match>
  @type stdout
</match>
  • fluentdの起動
cd C:\Temp\fluentd
fluentd -c ./fluent.conf
  • ログ確認(stdoutの内容が見れる)
2016-05-15 02:16:11 +0900 info.win: {"hostName":"game-PC"}
2016-05-15 02:16:21 +0900 info.win: {"hostName":"game-PC"}
2016-05-15 02:16:31 +0900 info.win: {"hostName":"game-PC"}
9
8
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
9
8