sebp/elkx 是一个自带X-Pack的镜像,目前最新版本为6.0
作者地址:https://hub.docker.com/r/sebp/elkx/
为了使用这个镜像,我研究了许多天,根据作者的描述为:
Usage notes
This image extends the sebp/elk image, so unless otherwise noted below the documentation for the seb/elk image applies.
Bootstrap mode
This image uses the default configuration of X-Pack, meaning that out of the box, as from version 6, the built-in users (especially the elastic superuser, and the basic kibana user) no longer have default passwords.
To define passwords (and create additional users as needed), a container first needs to be started in bootstrap mode in order to assign a bootstrap password to the elastic superuser.
As described in the official X-Pack documentation:
The bootstrap password is a transient password that enables you to run the tools that set all the built-in user passwords.
To set the bootstrap password for elastic, start a container with the ELASTIC_BOOTSTRAP_PASSWORD environment variable set to the chosen password.
Once the container has started, only Elasticsearch will be running, and the user can use the elastic account (with the bootstrap password) to change its own password and assign passwords to the built-in users, for instance:
by manually docker exec-ing into the running container and using the setup-passwords tool,
or by manually or programmatically using the user management REST APIs.
Once all the passwords have been assigned, stop the container, and start the container in normal mode as described below.
使用引导模式引导容器,再修改密码一次才能引用,但是我对于这种描述毫无办法,后来在作者的评论里面,找到了相关设置方法,记下吧,只怕以后不记得了
elkx:
image: sebp/elkx
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
environment:
- ELASTIC_BOOTSTRAP_PASSWORD="changeme"
$ docker-compose up
Creating elkxdocker_elkx_1
Attaching to elkxdocker_elkx_1
elkx_1 | ERROR: Setting [bootstrap.pass] does not exist in the keystore.
elkx_1 | * Starting periodic command scheduler cron
elkx_1 | ...done.
elkx_1 | * Starting Elasticsearch Server
elkx_1 | ...done.
elkx_1 | waiting for Elasticsearch to be up (1/30)
...
$ docker exec -it <name of the running container> bash
# $ES_HOME/bin/x-pack/setup-passwords interactive
Initiating the setup of reserved user elastic,kibana,logstash_system passwords.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]: changeme
Reenter password for [elastic]: changeme
Enter password for [kibana]: changeme
Reenter password for [kibana]: changeme
Enter password for [logstash_system]: changeme
Reenter password for [logstash_system]: changeme
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [elastic]
#vi /opt/logstash/config/logstash.yml
#在文件尾插入如下内容
xpack.monitoring.elasticsearch.username: "logstash_system"
xpack.monitoring.elasticsearch.password: "changeme"
elkx:
image: sebp/elkx
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
environment:
- ELASTICSEARCH_USER=elastic
- ELASTICSEARCH_PASSWORD=changeme
- LOGSTASH_USER=elastic
- LOGSTASH_PASSWORD=changeme
- KIBANA_USER=kibana
- KIBANA_PASSWORD=changeme
filebeat.prospectors:
- type: log
enabled: true
paths:
- /var/log/*.log
#- c:\programdata\elasticsearch\logs\*
output.elasticsearch:
hosts: ["192.168.1.42:9200"]
#----------------------------- Logstash output --------------------------------
output.logstash:
hosts: ["127.0.0.1:5044"]
cat /etc/logstash/conf.d# cat 02-beats-input.conf
input {
beats {
port => 5044
ssl => true
ssl_certificate => "/etc/pki/tls/certs/logstash-beats.crt"
ssl_key => "/etc/pki/tls/private/logstash-beats.key"
}
}
#----------------------------- Logstash output --------------------------------
output.logstash:
# The Logstash hosts
hosts: ["elk:5044"]
# Optional SSL. By default is off.
# List of root certificates for HTTPS server verifications
#ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
# Certificate for SSL client authentication
#ssl.certificate: "/etc/pki/client/cert.pem"
# Client Certificate Key
#ssl.key: "/etc/pki/client/cert.key"
ssl.certificate_authorities: ["/ca/logstash-beats.crt"]