Skip to content

Commit 05b65ca

Browse files
Release v2.0.0 🚀
- ⬆️ Default Stack Version `7.12.0` => `7.16.2` ⬆️ - ✨Enabled SSL on HTTP Layer - Enables the usage of ELK Alerts - Enables the usage of ML Jobs - Enables the usage of SIEM features - ✨Add `make collect-docker-logs` option that will ship Host docker containers to ELK. - Removed `ElastAlert` & `Curator` from bundled tools, replaced with native ELK Features. - No Longer use Custom Built Images instead pull images directly from Registry.
1 parent 04e694a commit 05b65ca

39 files changed

+175
-903
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
COMPOSE_PROJECT_NAME=elastic
2-
ELK_VERSION=7.12.0
2+
ELK_VERSION=7.16.2
33

44
#----------- Resources --------------------------#
55
ELASTICSEARCH_HEAP=1024m

Makefile

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
.DEFAULT_GOAL:=help
22

3-
COMPOSE_ALL_FILES := -f docker-compose.yml -f docker-compose.monitor.yml -f docker-compose.tools.yml -f docker-compose.nodes.yml
3+
COMPOSE_ALL_FILES := -f docker-compose.yml -f docker-compose.monitor.yml -f docker-compose.tools.yml -f docker-compose.nodes.yml -f docker-compose.logs.yml
44
COMPOSE_MONITORING := -f docker-compose.yml -f docker-compose.monitor.yml
5+
COMPOSE_LOGGING := -f docker-compose.yml -f docker-compose.logs.yml
56
COMPOSE_TOOLS := -f docker-compose.yml -f docker-compose.tools.yml
67
COMPOSE_NODES := -f docker-compose.yml -f docker-compose.nodes.yml
78
ELK_SERVICES := elasticsearch logstash kibana
9+
ELK_LOG_COLLECTION := filebeat
810
ELK_MONITORING := elasticsearch-exporter logstash-exporter filebeat-cluster-logs
9-
ELK_TOOLS := curator elastalert rubban
11+
ELK_TOOLS := rubban
1012
ELK_NODES := elasticsearch-1 elasticsearch-2
1113
ELK_MAIN_SERVICES := ${ELK_SERVICES} ${ELK_MONITORING} ${ELK_TOOLS}
12-
ELK_ALL_SERVICES := ${ELK_MAIN_SERVICES} ${ELK_NODES}
14+
ELK_ALL_SERVICES := ${ELK_MAIN_SERVICES} ${ELK_NODES} ${ELK_LOG_COLLECTION}
1315
# --------------------------
1416

1517
# load .env so that Docker Swarm Commands has .env values too. (https://github.com/moby/moby/issues/29133)
@@ -41,6 +43,9 @@ up:
4143
monitoring: ## Start ELK Monitoring.
4244
@docker-compose ${COMPOSE_MONITORING} up -d --build ${ELK_MONITORING}
4345

46+
collect-docker-logs: ## Start Filebeat that collects all Host Docker Logs and ship it to ELK
47+
@docker-compose ${COMPOSE_LOGGING} up -d --build ${ELK_LOG_COLLECTION}
48+
4449
tools: ## Start ELK Tools (ElastAlert, Curator).
4550
@docker-compose ${COMPOSE_TOOLS} up -d --build ${ELK_TOOLS}
4651

@@ -49,6 +54,8 @@ nodes: ## Start Two Extra Elasticsearch Nodes
4954

5055
build: ## Build ELK and all its extra components.
5156
@docker-compose ${COMPOSE_ALL_FILES} build ${ELK_ALL_SERVICES}
57+
ps: ## Show all running containers.
58+
@docker-compose ${COMPOSE_ALL_FILES} ps
5259

5360
down: ## Down ELK and all its extra components.
5461
@docker-compose ${COMPOSE_ALL_FILES} down

README.md

+5-17
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h4 align="center">With tools like Curator, Rubban, ElastAlert for Alerting.</h4>
66
<p align="center">
77
<a>
8-
<img src="https://img.shields.io/badge/Elastic%20Stack-7.12.0-blue?style=flat&logo=elasticsearch" alt="Elastic Stack Version 7^^">
8+
<img src="https://img.shields.io/badge/Elastic%20Stack-7.16.2-blue?style=flat&logo=elasticsearch" alt="Elastic Stack Version 7^^">
99
</a>
1010
<a>
1111
<img src="https://img.shields.io/github/v/tag/sherifabdlnaby/elastdocker?label=release&amp;sort=semver">
@@ -29,7 +29,7 @@ Elastic Stack (**ELK**) Docker Composition, preconfigured with **Security**, **M
2929

3030
Based on [Official Elastic Docker Images](https://www.docker.elastic.co/)
3131

32-
Stack Version: [7.12.0](https://www.elastic.co/blog/elastic-stack-7-12-0-released)
32+
Stack Version: [7.16.2](https://www.elastic.co/blog/elastic-stack-7-16-2-released)
3333
> 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.
3434
3535
### Main Features 📜
@@ -171,7 +171,7 @@ $ make prune
171171
172172
* Some Configuration are parameterized in the `.env` file.
173173
* `ELASTIC_PASSWORD`, user `elastic`'s password (default: `changeme` _pls_).
174-
* `ELK_VERSION` Elastic Stack Version (default: `7.12.0`)
174+
* `ELK_VERSION` Elastic Stack Version (default: `7.16.2`)
175175
* `ELASTICSEARCH_HEAP`, how much Elasticsearch allocate from memory (default: 1GB -good for development only-)
176176
* `LOGSTASH_HEAP`, how much Logstash allocate from memory.
177177
* Other configurations which their such as cluster name, and node name, etc.
@@ -193,22 +193,10 @@ To Re-generate Keystore:
193193
make keystore
194194
```
195195
196-
### Enable SSL on HTTP
197-
198-
By default, only Transport Layer has SSL Enabled, to enable SSL on HTTP layer, add the following lines to `elasticsearch.yml`
199-
```yaml
200-
## - http
201-
xpack.security.http.ssl.enabled: true
202-
xpack.security.http.ssl.key: certs/elasticsearch.key
203-
xpack.security.http.ssl.certificate: certs/elasticsearch.crt
204-
xpack.security.http.ssl.certificate_authorities: certs/ca.crt
205-
xpack.security.http.ssl.client_authentication: optional
206-
```
207-
208-
> ⚠️ 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.
196+
### Notes
209197
210198
211-
### Notes
199+
- ⚠️ Elasticsearch HTTP layer is using SSL, thus mean you need to configure your elasticsearch clients with the `CA` in `secrets/certs/ca/ca.crt`, or configure client to ignore SSL Certificate Verification (e.g `--insecure` in `curl`).
212200
213201
- Adding Two Extra Nodes to the cluster will make the cluster depending on them and won't start without them again.
214202

docker-compose.logs.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.5'
2+
3+
# will contain all elasticsearch data.
4+
volumes:
5+
filebeat-data:
6+
7+
services:
8+
# Docker Logs Shipper ------------------------------
9+
filebeat:
10+
image: docker.elastic.co/beats/filebeat:${ELK_VERSION}
11+
restart: always
12+
# -e flag to log to stderr and disable syslog/file output
13+
command: -e --strict.perms=false
14+
user: root
15+
environment:
16+
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
17+
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
18+
KIBANA_HOST_PORT: ${KIBANA_HOST}:${KIBANA_PORT}
19+
ELASTICSEARCH_HOST_PORT: https://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
20+
volumes:
21+
- ./filebeat/filebeat.docker.logs.yml:/usr/share/filebeat/filebeat.yml:ro
22+
- /var/lib/docker/containers:/var/lib/docker/containers:ro
23+
- /var/run/docker.sock:/var/run/docker.sock:ro
24+
- filebeat-data:/var/lib/filebeat/data

docker-compose.monitor.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
elasticsearch-exporter:
77
image: justwatch/elasticsearch_exporter:1.1.0
88
restart: always
9-
command: ["--es.uri", "http://${ELASTIC_USERNAME}:${ELASTIC_PASSWORD}@${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}",
9+
command: ["--es.uri", "https://${ELASTIC_USERNAME}:${ELASTIC_PASSWORD}@${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}",
1010
"--es.all",
1111
"--es.snapshots",
1212
"--es.indices"]
@@ -22,11 +22,7 @@ services:
2222

2323
# Cluster Logs Shipper ------------------------------
2424
filebeat-cluster-logs:
25-
image: filebeat:elastdocker-${ELK_VERSION}
26-
build:
27-
context: tools/filebeat/
28-
args:
29-
ELK_VERSION: $ELK_VERSION
25+
image: docker.elastic.co/beats/filebeat:${ELK_VERSION}
3026
restart: always
3127
# -e flag to log to stderr and disable syslog/file output
3228
command: -e --strict.perms=false
@@ -35,8 +31,8 @@ services:
3531
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
3632
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
3733
KIBANA_HOST_PORT: ${KIBANA_HOST}:${KIBANA_PORT}
38-
ELASTICSEARCH_HOST_PORT: ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
34+
ELASTICSEARCH_HOST_PORT: https://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
3935
volumes:
40-
- ./tools/filebeat/monitor/filebeat_cluster_logs.yml:/usr/share/filebeat/filebeat.yml:ro
36+
- ./filebeat/filebeat.monitoring.yml:/usr/share/filebeat/filebeat.yml:ro
4137
- /var/lib/docker/containers:/var/lib/docker/containers:ro
4238
- /var/run/docker.sock:/var/run/docker.sock:ro

docker-compose.nodes.yml

+4-12
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ volumes:
77

88
services:
99
elasticsearch-1:
10-
image: elasticsearch:elastdocker-${ELK_VERSION}
11-
build:
12-
context: elasticsearch/
13-
args:
14-
ELK_VERSION: ${ELK_VERSION}
15-
# restart: unless-stopped
10+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
11+
restart: unless-stopped
1612
environment:
1713
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
1814
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
@@ -43,12 +39,8 @@ services:
4339
soft: 200000
4440
hard: 200000
4541
elasticsearch-2:
46-
image: elasticsearch:elastdocker-${ELK_VERSION}
47-
build:
48-
context: elasticsearch/
49-
args:
50-
ELK_VERSION: ${ELK_VERSION}
51-
# restart: unless-stopped
42+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
43+
restart: unless-stopped
5244
environment:
5345
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
5446
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}

docker-compose.setup.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,17 @@ version: '3.5'
22

33
services:
44
keystore:
5-
build:
6-
context: elasticsearch/
7-
args:
8-
ELK_VERSION: ${ELK_VERSION}
5+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
96
command: bash /setup/setup-keystore.sh
107
user: "0"
118
volumes:
129
- ./secrets:/secrets
1310
- ./setup/:/setup/
1411
environment:
1512
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
16-
# Add keystore values used in `keystore.sh` here. (e.g AMAZON S3 Repo Creds)
17-
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
18-
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
1913

2014
certs:
21-
build:
22-
context: elasticsearch/
23-
args:
24-
ELK_VERSION: ${ELK_VERSION}
15+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
2516
command: bash /setup/setup-certs.sh
2617
user: "0"
2718
volumes:

docker-compose.tools.yml

+3-30
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11
version: '3.5'
22

33
services:
4-
curator:
5-
image: curator:elastdocker-${ELK_VERSION}
6-
build:
7-
context: tools/curator/.
8-
restart: unless-stopped
9-
environment:
10-
ELASTICSEARCH_HOST_PORT: ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
11-
ELASTICSEARCH_HTTP_AUTH: ${ELASTIC_USERNAME}:${ELASTIC_PASSWORD}
12-
volumes:
13-
- ./tools/curator/curator.yml:/root/.curator/curator.yml:ro
14-
- ./tools/curator/crontab:/etc/crontab:ro
15-
- ./tools/curator/actions/:/actions/:ro
16-
17-
elastalert:
18-
image: sherifabdlnaby/elastalert:3.1.1
19-
restart: unless-stopped
20-
volumes:
21-
- ./tools/elastalert/config/elastalert.yaml:/opt/config/config.yaml
22-
- ./tools/elastalert/config/elastalert-test.yaml:/opt/config/config-test.yaml
23-
- ./tools/elastalert/config/config.json:/opt/config/config.json
24-
- ./tools/elastalert/rules:/opt/elastalert/rules
25-
- ./tools/elastalert/rule_templates:/opt/elastalert/rule_templates
26-
environment:
27-
ELASTICSEARCH_HOST: ${ELASTICSEARCH_HOST}
28-
ELASTICSEARCH_PORT: ${ELASTICSEARCH_PORT}
29-
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
30-
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
31-
ports:
32-
- 3030:3030
33-
344
rubban:
355
image: sherifabdlnaby/rubban:latest
366
restart: unless-stopped
@@ -41,3 +11,6 @@ services:
4111
RUBBAN_REFRESHINDEXPATTERN_ENABLED: 'true'
4212
RUBBAN_REFRESHINDEXPATTERN_SCHEDULE: '*/5 * * * *'
4313
RUBBAN_REFRESHINDEXPATTERN_PATTERNS: '*'
14+
RUBBAN_AUTOINDEXPATTERN_ENABLED: true
15+
RUBBAN_AUTOINDEXPATTERN_SCHEDULE: '*/5 * * * *'
16+
RUBBAN_AUTOINDEXPATTERN_GENERALPATTERNS: '[{"pattern":"filebeat?","timeFieldName":"@timestamp"},{"pattern":"logstash?","timeFieldName":"@timestamp"}]'

docker-compose.yml

+12-17
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ secrets:
2626

2727
services:
2828
elasticsearch:
29-
image: elasticsearch:elastdocker-${ELK_VERSION}
30-
build:
31-
context: elasticsearch/
32-
args:
33-
ELK_VERSION: ${ELK_VERSION}
29+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
3430
restart: unless-stopped
3531
environment:
3632
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
@@ -64,40 +60,39 @@ services:
6460
nofile:
6561
soft: 200000
6662
hard: 200000
63+
healthcheck:
64+
test: ["CMD", "sh", "-c", "curl -sf --insecure https://$ELASTIC_USERNAME:$ELASTIC_PASSWORD@localhost:9200/_cat/health | grep -ioE 'green|yellow' || echo 'not green/yellow cluster status'"]
6765

6866
logstash:
69-
image: logstash:elastdocker-${ELK_VERSION}
70-
build:
71-
context: logstash/
72-
args:
73-
ELK_VERSION: $ELK_VERSION
67+
image: docker.elastic.co/logstash/logstash:${ELK_VERSION}
7468
restart: unless-stopped
7569
volumes:
7670
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
7771
- ./logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
7872
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro
73+
secrets:
74+
- source: elastic.ca
75+
target: /certs/ca.crt
7976
environment:
8077
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
8178
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
82-
ELASTICSEARCH_HOST_PORT: ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
79+
ELASTICSEARCH_HOST_PORT: https://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
8380
LS_JAVA_OPTS: "-Xmx${LOGSTASH_HEAP} -Xms${LOGSTASH_HEAP}"
8481
ports:
8582
- "5044:5044"
8683
- "9600:9600"
84+
healthcheck:
85+
test: ["CMD", "curl", "-s" ,"-XGET", "http://127.0.0.1:9600"]
8786

8887
kibana:
89-
image: kibana:elastdocker-${ELK_VERSION}
90-
build:
91-
context: kibana/
92-
args:
93-
ELK_VERSION: $ELK_VERSION
88+
image: docker.elastic.co/kibana/kibana:${ELK_VERSION}
9489
restart: unless-stopped
9590
volumes:
9691
- ./kibana/config/:/usr/share/kibana/config:ro
9792
environment:
9893
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
9994
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
100-
ELASTICSEARCH_HOST_PORT: ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
95+
ELASTICSEARCH_HOST_PORT: https://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
10196
secrets:
10297
- source: elastic.ca
10398
target: /certs/ca.crt

elasticsearch/Dockerfile

-12
This file was deleted.

elasticsearch/config/elasticsearch.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ xpack.security.transport.ssl.certificate: certs/elasticsearch.crt
2424
xpack.security.transport.ssl.certificate_authorities: certs/ca.crt
2525

2626
## - http
27-
#xpack.security.http.ssl.enabled: true
28-
#xpack.security.http.ssl.key: certs/elasticsearch.key
29-
#xpack.security.http.ssl.certificate: certs/elasticsearch.crt
30-
#xpack.security.http.ssl.certificate_authorities: certs/ca.crt
31-
#xpack.security.http.ssl.client_authentication: optional
27+
xpack.security.http.ssl.enabled: true
28+
xpack.security.http.ssl.key: certs/elasticsearch.key
29+
xpack.security.http.ssl.certificate: certs/elasticsearch.crt
30+
xpack.security.http.ssl.certificate_authorities: certs/ca.crt
31+
xpack.security.http.ssl.client_authentication: optional
3232

3333
# Monitoring
3434
xpack.monitoring.collection.enabled: true

elasticsearch/scripts/docker-healthcheck

-14
This file was deleted.

0 commit comments

Comments
 (0)