Skip to content

Instantly share code, notes, and snippets.

@YoshihitoAso
Created May 15, 2013 10:48
Show Gist options
  • Select an option

  • Save YoshihitoAso/5583125 to your computer and use it in GitHub Desktop.

Select an option

Save YoshihitoAso/5583125 to your computer and use it in GitHub Desktop.
[Splunk][Fluentd]Amazon Linux でsplunk storm を使ってみる (fluentdでログ送信)
Amazon Linuxでsplunk storm を使ってみたメモ
基本的に以下のサイトの通り。
memorycraft: splunkってなんじゃ?(splunk stormでfluentd)
http://memocra.blogspot.jp/2013/04/splunksplunk-stormfluentd.html
▼ fluentd install
$ curl -OL http://toolbelt.treasure-data.com/sh/install-redhat.sh
$ chmod 755 install-redhat.sh
$ ./install-redhat.sh
$ rm -f install-redhat.sh
$ service td-agent start
$ chkconfig td-agent on
▼ td-agentが利用するディレクトリの権限を変更 chmod, chgrp
$ sudo chgrp td-agent /var/log/httpd/
$ sudo chgrp td-agent /var/log/messages
$ sudo chgrp td-agent /var/log/secure
$ sudo chgrp td-agent /var/log/cron
$ sudo chmod g+rx /var/log/httpd/
$ sudo chmod g+rx /var/log/messages
$ sudo chmod g+rx /var/log/secure
$ sudo chmod g+rx /var/log/cron
▼ splunk storm 用のfluent-pluginのインストール
これ↓をインストール
k24d/fluent-plugin-splunkapi · GitHub
https://github.com/k24d/fluent-plugin-splunkapi
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem update
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-splunkapi
td-agent.conf設定を書き換える
$ vi /etc/td-agent/td-agent.conf
<source>
type tail
format apache
path /var/log/httpd/access_log
tag server1.apache.access
</source>
<match *.apache.*>
type splunkapi
access_token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
project_id YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
protocol storm
sourcetype fluent
format text
flush_interval 10s
buffer_type memory
buffer_queue_limit 16
</match>
access_token、project_id はsplunk stormで作成したプロジェクトのもの。
▼ サービスを起動
$ service httpd restart
$ service td-agent restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment