[[fluentd]]

*Fluentdインストール(1台のみでApacheのログでテスト) [#d26a1ed6]
 # yum install sudo -y
 # curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh
 →公式インストール手順。リポジトリを引っ張ってインストール。
 # cd /etc/td-agent
 # cp -p td-agent.conf td-agent.conf.org
 # vim td-agent.conf
 
***Apacheの場合ここから [#z06851ed]
 <source>
 type tail
 path /var/log/httpd/*access_log
 pos_file /tmp/access_log.pos
 format apache2
 tag apache2.access_log
 </source>
 
 <match apache2.access_log>
  type file
  path /var/log/td-agent/copy-access_log
 </match>

***nginxの場合ここから [#qdcca822]
 <source>
 type tail
 path /var/log/nginx/access.log
 pos_file /var/lib/fluent/access.pos
 tag nginx.access
 format /^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)" "(?<forwader>[^\"]*)")?$/
 time_format %d/%b/%Y:%H:%M:%S %z
 </source>
 
 # chmod 775 /var/log/nginx
 # usermod -G nginx td-agent

*起動 [#nfd97741]
 # /etc/init.d/td-agent configtest  <-- なにも表示されなければOK
 # /etc/init.d/td-agent start
 # /etc/init.d/td-agent status
 td-agent (pid  2201) を実行中...
 # chkconfig td-agent on

*参考URL [#aed94a30]
http://docs.fluentd.org/articles/install-by-rpm#step-1-install-from-rpm-repository

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS