OSS編~Fluented & Elasticsearch & Kibanaパート①~

**

Elasticseachのインストール

**

2. Elasticseachのインストール

今回はRPMを利用してElasticseachをインストールしてみます。

1# wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.3.noarch.rpm23# rpm -i elasticsearch-0.90.3.noarch.rpm45# /etc/rc.d/init.d/elasticsearch start67Starting elasticsearch: [  OK  ]

**

Fluentedとfluent-plugin-elasticsearchをインストール

**

3.Fluentedのインストール

次にFluentedとfluent-plugin-elasticsearchをインストールします。

※Fluented本体は以前の記事をご参照下さい。

1# /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch2Fetching: fluent-plugin-elasticsearch-0.1.4.gem (100%)3Fetching: cool.io-1.1.1.gem (100%)4Building native extensions.  This could take a while...5Successfully installed fluent-plugin-elasticsearch-0.1.46Successfully installed cool.io-1.1.172 gems installed8Installing ri documentation for fluent-plugin-elasticsearch-0.1.4...9Installing ri documentation for cool.io-1.1.1...10Installing RDoc documentation for fluent-plugin-elasticsearch-0.1.4...11Installing RDoc documentation for cool.io-1.1.1...

Elasticseach用の設定を追加します。

「includetagkey true」と「tagkey @logname」を設定することで kibana で「tag_key」による絞り込みが可能となります。

1# vim /etc/td-agent/td-agent.conf
1<source>2        type tail3        format apache4        path /var/log/httpd/access.log5        tag ec2.apache.access6        pos_file /tmp/apache.pos7</source>
1<match *.apache.*>2        index_name fluent-elas3        type_name apache4        type elasticsearch5        include_tag_key true6        tag_key @log_name7        host xxx.xxx.xxx.xxx8        port 92009        logstash_format true10        flush_interval 10s11</match>

設定を反映させます。

1# /etc/rc.d/init.d/td-agent restart2Shutting down td-agent:                                    [  OK  ]3Starting td-agent:                                         [  OK  ]

今回はここまでとなります。

いかがでしたでしょうか?

次回は『OSS編~Fluented & Elasticseach & Kibana パート②~』ということで、Kibanaをインストールして実際にログを解析してみたいと思います。

お楽しみに!

——————————————————————————————————

ナレコムクラウドのFacebookに『いいね!』をクリックして頂くと

最新のお役立ちレシピが配信されます★

┏━━━━━━━━━━━━━┓

┃ナレコムクラウド Facebook┃

┗━━━━━━━━━━━━━┛

——————————————————————————————————

この記事を書いた人

aws-recipe-user