From 0e5aee02cf0c481ce0d3d8971d1b6e0561034a29 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 28 May 2021 16:22:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0logstash=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/logstash-springboot.conf | 14 ++++++++++++++ docker-compose.yml | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 config/logstash-springboot.conf diff --git a/config/logstash-springboot.conf b/config/logstash-springboot.conf new file mode 100644 index 0000000..07f647b --- /dev/null +++ b/config/logstash-springboot.conf @@ -0,0 +1,14 @@ +input { + tcp { + mode => "server" + host => "0.0.0.0" + port => 4560 + codec => json_lines + } +} +output { + elasticsearch { + hosts => "elasticsearch:9200" + index => "springboot-logstash-%{+YYYY.MM.dd}" + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e9fb3aa..6a52737 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,7 +73,18 @@ services: # - "./config/kibana.yml:/usr/share/kibana/config/kibana.yml" networks: - stack + depends_on: ['elasticsearch'] + + + logstash: + image: logstash:7.3.0 + container_name: logstash + volumes: + - ./config/logstash-springboot.conf:/usr/share/logstash/pipeline/logstash.conf #挂载logstash的配置文件 + networks: + - stack depends_on: ['elasticsearch'] + ports: ['4560:4560'] # rocket mq name server rmqnamesrv: