1.下载镜像
docker pull logstash:8.5.2
2.创建配置文件
cat > /mnt/docker/elk/logstash/pipeline/logstash.conf << EOF input { tcp { mode => "server" host => "0.0.0.0" port => 5044 codec => json_lines } } output { elasticsearch { hosts => "127.0.0.1:9200" index => "%{[spring.application.name]}-%{+YYYY.MM.dd}" } } EOF
cat > /mnt/docker/elk/logstash/config/logstash.yml << EOF http.host: "0.0.0.0" xpack.monitoring.elasticsearch.hosts: [ "http://127.0.0.1:9200" ] EOF
3.创建容器
docker run -d --name logstash -m 1000M --restart=always -p 5044:5044 -p 9600:9600 --privileged=true -e ES_JAVA_OPTS="-Duser.timezone=Asia/Shanghai" -v /mnt/docker/elk/logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf -v /mnt/docker/elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml logstash:8.5.2
整合SpringBoot收集日志请参考:https://lionli.blog.csdn.net/article/details/125743132
标签:elk,logstash,config,mnt,Logstash,conf,docker,安装,Docker From: https://www.cnblogs.com/fanqisoft/p/16972049.html