Package installation
- Install java jre 8 :
sudo apt-get install openjdk-8-jre
- Add elastic key :
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- Install apt-transport-https :
sudo apt-get install apt-transport-https
- Add elastic apt source :
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.lis
- Install ELK packages :
sudo apt-get update && sudo apt-get install elasticsearch kibana logstash
Configuration files
Elasticsearch :
sudo vim /etc/elasticsearch/elasticsearch.yml
- Change
network.host
to the ip you want to listen - Change
http.port
if you want to elasticsearch to listen in different properties, 9200 is the default port
- Change
Kibana :
sudo vim /etc/kibana/kibana.yml
- Change
server.host
to the ip you want to listen - Change
server.port
if you want to elasticsearch to listen in different properties, 5601 is the defaut port - Change
elasticsearch.url
to your elasticsearch server
- Change
Logstash :
- Apache2 access parser example
sudo vim /etc/logstash/conf.d/apache2.conf
:
- Apache2 access parser example
|
|
- Nginx access parser example `sudo vim /etc/logstash/conf.d/nginx.conf
|
|
Start service
|
|
Test
To test lesticsearch installation execute this command curl localhost:9200
, if elesticsearch is already started you see this result :
|
|
To test kibana installation go to this url in your browser : http://localhost:5601
Get data from elasticsearch
- List all indexes :
curl "localhost:9200/_cat/indices?v"
- List all data from the index .kibana :
curl "localhost:9200/.kibana/_search?pretty=true&q=*:*"
Sources
- https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elk-stack-on-ubuntu-14-04
- https://www.elastic.co/guide/en/logstash/current/installing-logstash.html
- https://www.elastic.co/guide/en/kibana/current/deb.html
- https://www.elastic.co/guide/en/logstash/current/config-examples.html
- https://logz.io/blog/nginx-log-analysis/