Docker 安裝 Logstash
阿新 • • 發佈:2022-12-10
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