Logging by Fluent Logger

C++版

現在のところUbuntuのみの対応

Fluent Bitのインストール

 wget https://github.com/fluent/fluent-bit/archive/v1.0.4.tar.gz
 tar xf v1.0.4.tar.gz
 cd fluent-bit-1.0.4/
 cd build
 cmake ..
 cmake --build . --config Release -- -j$(nproc)
 sudo cmake --build . --target install

各種ライブラリのインストール

 sudo apt install xsltproc
 export FLUENT_LIB_DIR=~/fluent-bit-1.0.4/lib
 
 cd ${FLUENT_LIB_DIR}/jemalloc-5.1.0
 ./configure
 make
 make dist
 sudo make install
 
 cd ${FLUENT_LIB_DIR}/monkey
 mkdir build
 cd build
 cmake .. -DMK_SYSTEM_MALLOC=ON -DMK_PLUGIN_AUTH=No -DMK_PLUGIN_CGI=No -DMK_PLUGIN_CHEETAH=No -DMK_PLUGIN_FASTCGI=No -DMK_PLUGIN_LOGGER=No -DWITHOUT_HEADERS=Yes
 cmake --build . --config Release -- -j$(nproc)
 sudo cmake --build . --target install
 
 cd ${FLUENT_LIB_DIR}/mbedtls-2.14.1
 mkdir build
 cd build
 cmake .. -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF
 cmake --build . --config Release -- -j$(nproc)
 sudo cmake --build . --target install
 
 cd ${FLUENT_LIB_DIR}/msgpack-3.1.1
 mkdir build
 cd build
 cmake .. -DMSGPACK_BUILD_EXAMPLES=OFF
 cmake --build . --config Release -- -j$(nproc)
 sudo cmake --build . --target install
 
 cd ${FLUENT_LIB_DIR}/onigmo
 ./configure
 make
 sudo make install

OpenRTM-aistのビルド

CMake実行時にFLUENTBIT_ENABLEFLUENTBIT_ROOTのオプションを設定する。

 cmake -DCORBA=omniORB -DFLUENTBIT_ENABLE=ON -DFLUENTBIT_ROOT=~/fluent-bit-1.0.4/ ..

他の手順は通常のビルド手順と同じである。

以下のコマンドでインストールしてください。

 cmake --build . --target install

動作確認

rtc.confで以下のように設定する。tagの名前は適宜変更する。

 
 logger.plugins: /usr/local/lib/openrtm-2.0/logger/FluentBit.so
 logger.logstream.fluentd.output0.plugin: forward
 logger.logstream.fluentd.output0.match:*
 
 logger.logstream.fluentd.input0.plugin: lib
 logger.logstream.fluentd.input0.tag: test.simpleio

RTCを実行するとログを送信する。

動作しない場合は/etc/ssl/certsから壊れたリンクを削除する。

Python版

Python版はWindows、Linuxへ対応

fluent-logger-pythonのインストール

fluent-logger-pythonのインストールが必要です。

fluent-logger-python-0.9.3.zipを適当な場所に展開して以下のコマンドを実行してください。

 python setup.py install

Linuxの場合はsudoで実行してください。

Fluentdのインストール、起動

ほとんど以下のページと手順は同じです。

Fluentdをインストールしてください。

インストール後、Td-agent Command Promptを起動してください。

次にtd-agentをインストールしたフォルダ(C:\opt\td-agent)にconf\td-agent.confというファイルを作成します。

 C:\opt\td-agent
                 |- conf
                       |-td-agent.conf

td-agent.confには以下の内容を記述します。

 <source>
   @type forward
 </source>
 
 <match test.**>
   @type stdout
 </match>

Td-agent Command Promptで以下のコマンドを入力してfluentdを実行します。

 > fluentd -c conf\td-agent.conf

RTCの起動

rtc.confに以下のように記述してRTCを起動するとfluentdにログが送信されます。

 manager.modules.load_path: C:\\Python27\\Lib\\site-packages\\OpenRTM_aist\\ext\\logger\\fluentbit_stream
 logger.plugins: FluentBit.py
 logger.logstream.fluentd.output0.tag: test.simpleio

manager.modules.load_pathはOpenRTM-aistをインストールしたPythonのパスによって適宜変更してください。 Ubuntuの場合は/usr/local/lib/python2.7/dist-packages/OpenRTM_aist/ext/logger/fluentbit_stream等になります。

fluentdでログは以下のように表示される。

 2018-12-26 09:06:18.000000000 +0900 test.simpleio: {"message":"exit","time":"2018-12-26 09:06:18,841","name":"fluent.ec_worker","level":"TRACE"}

メッセージの内容、名前、ログを送信した時間、ログレベルが送信される。

Download

latest Releases : 2.0.0-RELESE

2.0.0-RELESE Download page

Number of Projects

Choreonoid

Motion editor/Dynamics simulator

OpenHRP3

Dynamics simulator

OpenRTP

Integrated Development Platform

AIST RTC collection

RT-Components collection by AIST

TORK

Tokyo Opensource Robotics Association

DAQ-Middleware

Middleware for DAQ (Data Aquisition) by KEK