Docker部署logstash7.9.1

it2024-12-17  14

参考文章:https://www.jianshu.com/p/88517124503d

1.连接阿里云ecs

ssh root@xxx.xx.x.xxx

2.下载镜像

docker pull logstash:7.9.1

3.修改配置

创建logstash.yml 和pipeline文件

mkdir /user/local/logstash    /user/local/pipeline cd /user/local/logstash/logstash.yml sudo vim logstash.yml config: reload: automatic: true interval: 3s xpack: management.enabled: false monitoring.enabled: false cd /user/local/pipeline/ sudo vim pipeline.yml pipeline.id: logstash_dev path.config: "/usr/share/logstash/pipeline/logstash_dev.conf"

4.配置logstash_dev.conf文件

在pipeline文件目录下创建conf文件,并将如下代码拷贝,修改主机地址

input { tcp { mode => "server" host => "0.0.0.0" port => 5047 codec => json_lines } } filter{ } output { elasticsearch { hosts => ["116.62.5.148:9200"] index => "logstash-dev-%{+YYYY.MM.dd}" } stdout { codec => rubydebug } }

5.运行容器

docker run -d -it --restart=always --privileged=true --name=logstash -p 5047:5047 -p 9600:9600 -v /user/local/logstash/pipeline/:/usr/share/logstash/pipeline/ -v /usr/local/logstash/config/:/usr/share/logstash/config/ logstash:7.9.1

6.docker  ps -a 查看容器启动情况,发现已启动

7.修改阿里云安全组出入规则,可外网访问

 

 

 

最新回复(0)