LoginSignup
10
9

More than 5 years have passed since last update.

elastic beats のfilebeatsをいじってみたぞメモ

Posted at

elastic searchの仲間でbeatsがあります。これが凄いとこちらの記事でみたので、どんなものか、ちょっと触ってみましたので、そのメモです。

beatsにはログ取集系のfilebeatとリソースの状況をみるtopbeat、通信の状況をみるpacketbeatがあります。

今回はfilebeatです。

インスートール

  1. インストールは簡単で、サイトから環境に合わせてtarをダウンロードして展開します。macの場合はここからダウンロードします。

filebeatのダウンロード.png

  1. ダウンロードしたら、それを解凍します。以上で終わりです。

設定

解凍した中には3つのファイルがあります。

filebeat
filebeat.yml
filebeat.template.json

filebeat.ymlの中身を見てみると、input先のログの指定とoutput先にelasticsearchやその他もろもろの設定をします。

filebeat:
  # List of prospectors to fetch data.
  prospectors:
    # Each - is a prospector. Below are the prospector specific configurations
    -
      # Paths that should be crawled and fetched. Glob based paths.
      # To fetch all ".log" files from a specific level of subdirectories
      # /var/log/*/*.log can be used.
      # For each file found under this path, a harvester is started.
      # Make sure not file is defined twice as this can lead to unexpected behaviour.
      paths:
        - /usr/local/project/famiphotos/log/rails_application*.log
      # - c:\programdata\elasticsearch\logs\*

・・・・・・・
・・・・・・・・
・・・・・・・・・

# Configure what outputs to use when sending the data collected by the beat.
# Multiple outputs may be used.
output:

  ### Elasticsearch as output
  elasticsearch:
    # Array of hosts to connect to.
    # Scheme and port can be left out and will be set to the default (http and 9200)
    # In case you specify and additional path, the scheme is required: http://localhost:9200/path
    # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
    hosts: ["192.168.25.50:9200"]

これを実際起動していくとfluentdと同じように指定したログがドンドンelasticsearchの方に格納されていきます。

で、サイトではこれをkibanaで見る方法まで記載あれてました。dashboardのテンプレートもあるので、手厚いサポートだなと思いました。
一番いいと思ったのは、こういうソリューションがフリーで使えるという点かと思います。

今後もちょくちょく情報を追記していきますが、一旦今日はここまで。

10
9
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
10
9