下载docker镜像

docker pull docker.elastic.co/logstash/logstash:6.5.4

创建文件夹 (用于容器文件的挂载)

mkdir /usr/local/logstash/config

创建相关配置文件

logstash.yml (空文件就行)
log4j2.properties
logger.elasticsearchoutput.name = logstash.outputs.elasticsearch
logger.elasticsearchoutput.level = debug
pipelines.yml(那个小杠杠很重要)
- pipeline.id: my-logstash
  path.config: "/usr/share/logstash/config/*.conf"
  pipeline.workers: 3
*.conf 文件
input {
  tcp {
    mode => "server"
    host => "0.0.0.0"
    port => 4567
  }
}
output {
  elasticsearch {
    action => "index"
    hosts  => "ip:200"
    index  => "index"
  }
}

启动命令

docker run -d -p 5044:5044 -p 9600:9600 -it -v /usr/local/logstash/config/:/usr/share/logstash/config/  docker.elastic.co/logstash/logstash:6.5.4
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐