mkdir -p /docker/elk/elasticsearch/{plugins,data}
mkdir -p /docker/elk/logstash
chmod 777 /docker/elk/elasticsearch/data
创建logstash配置文件
vim /docker/elk/logstash/logstash.conf
input {
tcp {
mode => "server"
host => "0.0.0.0"
port => 4560
codec => json_lines
}
}
output {
elasticsearch {
hosts => "es:9200"
index => "logstash-service-%{+YYYY.MM.dd}"
}
}
vim /docker/elk/docker-compose.yml
1.
version: '3'
services:
elasticsearch:
image: elasticsearch:6.4.0
container_name: elasticsearch
environment:
- "cluster.name=elasticsearch" #设置集群名称为elasticsearch
- "discover