1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Elastic Stack導入

Posted at

Ubuntu14.04.5にElastic Stack 5.0.1シリーズを入れます。

sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-5.0.1.deb
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.1.deb
curl -L -O https://artifacts.elastic.co/downloads/kibana/kibana-5.0.1-amd64.deb
sudo dpkg -i *
sudo apt-get -y install sysv-rc-conf
sudo sysv-rc-conf logstash on
sudo sysv-rc-conf elasticsearch on
sudo sysv-rc-conf kibana on

自動起動設定まで完了。
起動するにはホストでvagrant reloadするか、以下。

sudo service logstash start
sudo service elasticsearch start
sudo service kibana start

でもこのままじゃ動かないので…

sudo apt-get install emacs24-nox
sudo emacs /etc/logstash/conf.d/logstash.conf
/etc/logstash/conf.d/logstash.conf
input {
    file {
        path => "/home/vagrant/log/something.log"
        type => "something"
    }
    http {
        host => "localhost"
        port => "9600"
        type => "http"
    }
}
filter {
    date {
        match => [ "date", "YYYY/MM/dd", "YYYY/MM/dd HH:mm:ss", "YYYY/MM", "EEE, YYYY/MM/dd HH:mm:ss 'GMT'"]
        target => "date"
    }
}
output {
    elasticsearch {
        hosts => ["localhost:9200"]
        index => "%{type}-%{+YYYY.MM.dd}"
    }
}

設定ファイルの中身は、入れたいデータと相談です。細かい設定は公式を見るとよいでしょう。

ちなみにElastic Stackはメモリが足りないとServiceは走ってるように見えても動作してくれません。

ホスト側のVagrantfileのここを編集します。

  config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
    vb.memory = "4096"
  end

2GBでは動きません。4GBでは動きます。

Vagrantfile関連で。
proxyに囲まれて生活している方は以下の設定も必要です。

  config.proxy.http     = "http://proxy.jp:99999"
  config.proxy.https    = "http://proxy.jp:99999"
  config.proxy.no_proxy = "localhost,127.0.0.1,(他のVBのIP)"

ポートフォワーディング・Private_IPの設定は、ファイル内にひな形があるのでそれを見ましょう。

http://localhost:5601
(localhost or Privagte_IP)

見れたらめでたしめでたし。

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?