Skip to content

Commit 5bf93c2

Browse files
author
Toby McLaughlin
committed
Make Beats honour $ELASTIC_PASSWORD elastic#25
1 parent 816beda commit 5bf93c2

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

docker-compose.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ services:
4848
auditbeat:
4949
image: docker.elastic.co/beats/auditbeat:${TAG}
5050
container_name: auditbeat
51+
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
5152
cap_add: ['AUDIT_CONTROL', 'AUDIT_READ']
5253
# Auditbeat must run in the main process namespace.
5354
pid: host
@@ -57,6 +58,7 @@ services:
5758
filebeat:
5859
image: docker.elastic.co/beats/filebeat:${TAG}
5960
container_name: filebeat
61+
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
6062
# If the host system has logs at "/var/log", mount them at "/mnt/log"
6163
# inside the container, where Filebeat can find them.
6264
# volumes: ['/var/log:/mnt/log:ro']
@@ -66,6 +68,7 @@ services:
6668
heartbeat:
6769
image: docker.elastic.co/beats/heartbeat:${TAG}
6870
container_name: heartbeat
71+
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
6972
networks: ['stack']
7073
depends_on: ['elasticsearch', 'setup_heartbeat']
7174

@@ -80,7 +83,7 @@ services:
8083
# - /proc:/hostfs/proc:ro
8184
# - /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro
8285
# - /:/hostfs:ro
83-
command: metricbeat -e # -system.hostfs=/hostfs
86+
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}' # -system.hostfs=/hostfs
8487
networks: ['stack']
8588
depends_on: ['elasticsearch', 'setup_metricbeat']
8689

@@ -98,15 +101,15 @@ services:
98101
# that the other containers are connected to, and thus can't resolve the
99102
# hostname "elasticsearch". Instead, we'll tell it to find Elasticsearch
100103
# on "localhost", which is the Docker host machine in this context.
101-
command: packetbeat -v -e -E output.elasticsearch.hosts='["localhost:9200"]'
104+
command: -e -E 'output.elasticsearch.hosts=["localhost:9200"]' -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
102105
depends_on: ['elasticsearch']
103106

104107
apm_server:
105108
image: docker.elastic.co/apm/apm-server:${TAG}
106109
container_name: apm_server
107110
ports: ['127.0.0.1:8200:8200']
108111
networks: ['stack']
109-
command: apm-server -v -e
112+
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
110113
depends_on: ['elasticsearch','setup_apm_server']
111114

112115
# Run a short-lived container to set up Logstash.

scripts/setup-beat.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
set -euo pipefail
44

55
beat=$1
6-
es_url=http://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200
7-
86

97
until curl -s http://kibana:5601; do
108
sleep 2
@@ -16,4 +14,5 @@ sleep 5
1614
${beat} setup \
1715
-E setup.kibana.host=kibana \
1816
-E setup.kibana.username=elastic \
19-
-E setup.kibana.password=${ELASTIC_PASSWORD}
17+
-E setup.kibana.password=${ELASTIC_PASSWORD} \
18+
-E output.elasticsearch.password=${ELASTIC_PASSWORD}

0 commit comments

Comments
 (0)