All Projects → sherifabdlnaby → Elastdocker

sherifabdlnaby / Elastdocker

Licence: mit
🐳 Elastic Stack (ELK) on Docker, with preconfigured Security, Tools, Self-Monitoring, and Prometheus Metrics. Up with a Single Command.

Projects that are alternatives of or similar to Elastdocker

Docker Compose Elasticsearch Kibana
Docker Compose for Elasticsearch and Kibana
Stars: ✭ 584 (-33.86%)
Mutual labels:  elk, elk-stack, docker-compose
ansible
Ansible playbook automation for pfelk
Stars: ✭ 23 (-97.4%)
Mutual labels:  elk, elk-stack
ELK-Hunting
Threat Hunting with ELK Workshop (InfoSecWorld 2017)
Stars: ✭ 58 (-93.43%)
Mutual labels:  elk, elk-stack
Complete Guide To Elasticsearch
Contains all of the queries used within the Complete Guide to Elasticsearch course.
Stars: ✭ 829 (-6.12%)
Mutual labels:  elk, elk-stack
kiev
A set of tools to do distributed logging for Ruby web applications
Stars: ✭ 46 (-94.79%)
Mutual labels:  elk, elk-stack
rubban
Kibana Automatic Index Pattern Discovery and Other Elastic Stack Curating Tasks
Stars: ✭ 49 (-94.45%)
Mutual labels:  elk, elk-stack
eslog tutorial
From Raw Logs to Real Insights - A tutorial for getting started with log analytics using Elastic Stack.
Stars: ✭ 28 (-96.83%)
Mutual labels:  elk, elk-stack
Search Guard Ssl
Elasticsearch SSL for free. Supports native Open SSL.
Stars: ✭ 159 (-81.99%)
Mutual labels:  elk, elk-stack
docker-repo
A repository stores some dockerfiles or docker-compose files for quickly starting service or service cluster.
Stars: ✭ 26 (-97.06%)
Mutual labels:  elk, elk-stack
elastic-search-analyzer
基于elasticsearch,ik, 分词,全文搜索,使用demo
Stars: ✭ 41 (-95.36%)
Mutual labels:  elk, elk-stack
Helk
The Hunting ELK
Stars: ✭ 3,097 (+250.74%)
Mutual labels:  elk, elk-stack
lgrep
CLI for searching logstash and other elasticsearch based systems
Stars: ✭ 12 (-98.64%)
Mutual labels:  elk, elk-stack
Mozdef
DEPRECATED - MozDef: Mozilla Enterprise Defense Platform
Stars: ✭ 2,164 (+145.07%)
Mutual labels:  elk, elk-stack
search-guard-module-kibana-multitenancy
[OUTDATED] Provide multitenancy and other features for kibana
Stars: ✭ 15 (-98.3%)
Mutual labels:  elk, elk-stack
Search Guard
Search Guard Plugin - Security for Elasticsearch
Stars: ✭ 56 (-93.66%)
Mutual labels:  elk, elk-stack
data-processing-with-logstash
Contains the configuration files used within the Data Processing with Logstash course.
Stars: ✭ 76 (-91.39%)
Mutual labels:  elk, elk-stack
Docker Elk
The Elastic stack (ELK) powered by Docker and Compose.
Stars: ✭ 12,327 (+1296.04%)
Mutual labels:  elk, docker-compose
Json Logging Python
Python logging library to emit JSON log that can be easily indexed and searchable by logging infrastructure such as ELK, EFK, AWS Cloudwatch, GCP Stackdriver
Stars: ✭ 143 (-83.81%)
Mutual labels:  elk, elk-stack
elk-in-docker
ELK cluster in docker
Stars: ✭ 23 (-97.4%)
Mutual labels:  elk, elk-stack
Logagent Js
Extensible log shipper with input/output plugins, buffering, parsing, data masking, and small memory/CPU footprint
Stars: ✭ 333 (-62.29%)
Mutual labels:  elk, elk-stack

Elastic Stack on Docker with Preconfigured Security, Tools, Self-Monitoring, and Prometheus Metrics Exporters

With tools like Curator, Rubban, ElastAlert for Alerting.

Elastic Stack Version 7^^ contributions welcome GitHub forks GitHub issues GitHub license

Introduction

Elastic Stack (ELK) Docker Composition, preconfigured with Security, Monitoring, and Tools; Up with a Single Command.

Based on Official Elastic Docker Images

Stack Version: 7.11.1

You can change Elastic Stack version by setting ELK_VERSION in .env file and rebuild your images. Any version >= 7.0.0 is compatible with this template.

Main Features 📜

  • Configured as Production Single Node Cluster. (With a multi-node cluster option for experimenting).
  • Deployed on a Single Docker Host or a Docker Swarm Cluster.
  • Security Enabled (under basic license).
  • SSL Enabled for Transport Layer and Kibana.
  • Use Docker-Compose and .env to configure your entire stack parameters.
  • Persist Elasticsearch's Keystore and SSL Certifications.
  • Self-Monitoring Metrics Enabled.
  • Prometheus Exporters for Stack Metrics.
  • Embedded Container Healthchecks for Stack Images.
  • ElastAlert preconfigured for Alerting.
  • Curator with Crond preconfigured for Automated Scheduled tasks (e.g Snapshots to S3).
  • Rubban for Kibana curating tasks.

More points

And comparing Elastdocker and the popular deviantony/docker-elk

Expand...

One of the most popular ELK on Docker repositories is the awesome deviantony/docker-elk. Elastdocker differs from deviantony/docker-elk in the following points.

  • Security enabled by default using Basic license, not Trial.

  • Persisting data by default in a volume.

  • Run in Production Mode (by enabling SSL on Transport Layer, and add initial master node settings).

  • Persisting Generated Keystore, and create an extendable script that makes it easier to recreate it every-time the container is created.

  • Parameterize credentials in .env instead of hardcoding elastich:changeme in every component config.

  • Parameterize all other Config like Heap Size.

  • Add recommended environment configurations as Ulimits and Swap disable to the docker-compose.

  • Make it ready to be extended into a multinode cluster.

  • Configuring the Self-Monitoring and the Filebeat agent that ship ELK logs to ELK itself. (as a step to shipping it to a monitoring cluster in the future).

  • Configured tools and Prometheus Exporters.

  • The Makefile that simplifies everything into some simple commands.


Requirements

Setup

  1. Clone the Repository

    git clone https://github.com/sherifabdlnaby/elastdocker.git
    
  2. Initialize Elasticsearch Keystore and TLS Self-Signed Certificates

    $ make setup
    

    For Linux's docker hosts only. By default virtual memory is not enough so run the next command as root sysctl -w vm.max_map_count=262144

  3. Start Elastic Stack

    $ make elk           <OR>         $ docker-compose up -d
    
  4. Visit Kibana at https://localhost:5601 or https://<your_public_ip>:5601

    Default Username: elastic, Password: changeme

    • Notice that Kibana is configured to use HTTPS, so you'll need to write https:// before localhost:5601 in the browser.
    • Modify .env file for your needs, most importantly ELASTIC_PASSWORD that setup your superuser elastic's password, ELASTICSEARCH_HEAP & LOGSTASH_HEAP for Elasticsearch & Logstash Heap Size.

Whatever your Host (e.g AWS EC2, Azure, DigitalOcean, or on-premise server), once you expose your host to the network, ELK component will be accessible on their respective ports.

Docker Swarm Support

Elastdocker can be deployed to Docker Swarm using make swarm-deploy

Expand

However it is not recommended to depend on Docker Swarm; if your scale needs a multi-host cluster to host your ELK then Kubernetes is the recommended next step.

Elastdocker should be used for small production workloads enough to fit on a single host.

Docker Swarm lacks some features such as ulimits used to disable swapping in Elasticsearch container, please change bootstrap.memory_lock to false in docker-compose.yml and find an alternative way to disable swapping in your swarm cluster.

Additional Commands

Expand

To Start Monitoring and Prometheus Exporters

$ make monitoring

To Start Tools (ElastAlert, Rubban, and Curator)

$ make tools

To Start Elastic Stack, Tools and Monitoring

$ make all

To Start 2 Extra Elasticsearch nodes (recommended for experimenting only)

$ make nodes

To Rebuild Images

$ make build

Bring down the stack.

$ make down

Reset everything, Remove all containers, and delete DATA!

$ make prune

Configuration

  • Some Configuration are parameterized in the .env file.
    • ELASTIC_PASSWORD, user elastic's password (default: changeme pls).
    • ELK_VERSION Elastic Stack Version (default: 7.11.1)
    • ELASTICSEARCH_HEAP, how much Elasticsearch allocate from memory (default: 1GB -good for development only-)
    • LOGSTASH_HEAP, how much Logstash allocate from memory.
    • Other configurations which their such as cluster name, and node name, etc.
  • Elasticsearch Configuration in elasticsearch.yml at ./elasticsearch/config.
  • Logstash Configuration in logstash.yml at ./elasticsearch/config/logstash.yml.
  • Logstash Pipeline in main.conf at ./elasticsearch/pipeline/main.conf.
  • Kibana Configuration in kibana.yml at ./kibana/config.
  • ElastAlert Configuration in ./tools/elastalert/config.
  • ElastAlert Alert rules in ./tools/elastalert/rules, head to ElastAlert docs to lookup how to create alerts.
  • Curator Actions at ./tools/curator/actions and ./tools/curator/crontab.
  • Rubban Configuration using Docker-Compose passed Environment Variables.

Setting Up Keystore

You can extend the Keystore generation script by adding keys to ./setup/keystore.sh script. (e.g Add S3 Snapshot Repository Credentials)

To Re-generate Keystore:

make keystore

Enable SSL on HTTP

By default, only Transport Layer has SSL Enabled, to enable SSL on HTTP layer, add the following lines to elasticsearch.yml

## - http
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.key: certs/elasticsearch.key
xpack.security.http.ssl.certificate: certs/elasticsearch.crt
xpack.security.http.ssl.certificate_authorities: certs/ca.crt
xpack.security.http.ssl.client_authentication: optional

⚠️ Enabling SSL on HTTP layer will require all clients that connect to Elasticsearch to configure SSL connection for HTTP, this includes all the current configured parts of the stack (e.g Logstash, Kibana, Curator, etc) plus any library/binding that connects to Elasticsearch from your application code.

Notes

  • Adding Two Extra Nodes to the cluster will make the cluster depending on them and won't start without them again.

  • Makefile is a wrapper around Docker-Compose commands, use make help to know every command.

  • Elasticsearch will save its data to a volume named elasticsearch-data

  • Elasticsearch Keystore (that contains passwords and credentials) and SSL Certificate are generated in the ./secrets directory by the setup command.

  • Make sure to run make setup if you changed ELASTIC_PASSWORD and to restart the stack afterwards.

  • For Linux Users it's recommended to set the following configuration (run as root)

    sysctl -w vm.max_map_count=262144
    

    By default, Virtual Memory is not enough.


Monitoring The Cluster

Via Prometheus Exporters

If you started Prometheus Exporters using make monitoring command. Prometheus Exporters will expose metrics at the following ports.

Prometheus Exporter Port Recommended Grafana Dashboard
elasticsearch-exporter 9114 Elasticsearch by Kristian Jensen
logstash-exporter 9304 logstash-monitoring by dpavlos

Metrics

Via Self-Monitoring

Head to Stack Monitoring tab in Kibana to see cluster metrics for all stack components.

Metrics Metrics

In Production, cluster metrics should be shipped to another dedicated monitoring cluster.

License

MIT License Copyright (c) 2020 Sherif Abdel-Naby

Contribution

PR(s) are Open and Welcomed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].