简体   繁体   中英

How should I replace a reference to an IP in Docker Swarm

I am trying to install ELK in Docker Swarm mode.

Then, I need to tell filebeat to send logs to logstash.

Here is my filebeat config file:

#=========================== Filebeat prospectors =============================
## Each - is a prospector. Most options can be set at the prospector level, so
## you can use different prospectors for various configurations.
## Below are the prospector specific configurations.
filebeat.prospectors:
- input_type: log
  enabled: true
  paths:
{% for log in in_filebeat_dict.filebeat.logs | default([]) %}
    - {{ log }}
{% endfor %}

#================================ Outputs =====================================
# Configure what output to use when sending the data collected by the beat.
output.logstash:
  hosts: ["{{ in_filebeat_dict.filebeat.output.logstash }}:{{ in_filebeat_dict.filebeat.output.port}}"]

but in_filebeat_dict.filebeat.output.logstash is an IP and in Swarm mode, Swarm will not decide where to install containers, so I'm a bit stuck here...

Any ideas ???

In swarm mode discovery works over ne --name parameter. So when you deploy logstash with --name logstash other services can access it by calling the name logstash . But remember, they need to be in the same network which is not ingress. Create a new overlay network if you haven't done it yet and assign all services to that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM