docker 安装运行 logstash

说明
基于:centos7+   logstash:7.6.2

1、拉取镜像
 

docker pull logstash:7.6.2

2、创建数据存储目录

mkdir -p /data/docker/elk/logstash/config
mkdir -p /data/docker/elk/logstash/conf.d

创建vim /data/docker/elk/logstash/logstash.yml 文件

path.config: /usr/share/logstash/conf.d/*.conf 
path.logs: /var/log/logstash

 创建vim /data/docker/elk/logstash/conf.d/test.conf 文件

input {
    beats {
    port => 5044
    codec => "json"
}
}

output {
  elasticsearch { hosts => ["elasticsearchIP:9200"] }
  stdout { codec => rubydebug }
}

2、启动镜像
 

docker run -di --name logstash -p 5044:5044 logstash:7.6.2

启动镜像(数据挂载在宿主机)
 

docker run -di --name logstash -p 5044:5044 -v /data/docker/elk/logstash/logstash.yml:/usr/share/logstash/config/logstash.yml -v /data/docker/elk/logstash/conf.d/:/usr/share/logstash/conf.d/ logstash:7.6.2

你可能感兴趣的:(elk,docker,centos7,docker,centos,elk)