How to do a basic install of an ELK stack on Ubuntu for log stashing?
Use a machine with at least 4GiB of RAM. This guide will install
ElasticSearch, Logstash and Kibana all on the same machine, so this is
suited only for a small-scale setup.
Warning: ELK is under contant development, and this guide is
probably out of date now…
Install and configure ElasticSearch
Then edit /etc/elasticsearch/elasticsearch.yml and do the following:
Set node.name to something descriptive
Set cluster.name to something unique to avoid issues with
auto-discovery
Set network.host to “localhost”
Change path.data and path.logs if necessary
Edit /etc/elasticsearch/jvm.options and set the heap size according
to your machine RAM, for example (to set it to 2GiB):
Probably the easiest is to divide the available RAM by 4 and take that
figure for each service (ElasticSearch, Logstash and Kibana, with the
rest for the OS).
A setting of 1GiB is probably the minimum you should use.
Make sure you disable swapping!
Install and configure Kibana
Run this: $ sudo apt install kibana. Then edit
/etc/kibana/kibana.yml
and set server.host to “localhost”. Then:
Create a DNS entry for your kibana host and an SSL certificate.
Install nginx as reverse proxy with authentication:
Then edit an nginx site file (eg: /etc/nginx/sites-available/kibana)
and make it look like this:
Activate the site like so:
Install and configure logstash
Just run: $ sudo apt install logstash. Edit
/etc/logstash/jvm.options and set the heap size according to your
machine RAM, for example (to set it to 2GiB):
A setting of 1GiB is probably the minimum you should use. Create a
file /etc/logstash/conf.d/GIVE_ME_A_NAME.conf and edit it so it
looks like this:
Then run:
NB: The grok patterns assume the following log formats for apache: