一、Spring Boot 日志配置
采用 Spring Boot 默认的 Logback:
1 | <?xml version="1.0" encoding="UTF-8"?> |
输出的日志格式如下:
1 | 2020-06-02 15:05:14,903 INFO [http-nio-18000-exec-1] com.example.demo.TestController - test log |
二、FileBeat 配置文件
1 | filebeat.inputs: |
三、Logstash 配置文件
1 | input { |
四、使用
启动 FileBeat,看到类似如下输出:
1 | { |
上面的 log、message 等信息我们不需要,可以在配置中去掉,修改 Logstash 配置:
1 | input { |
修改后效果:
1 | { |
实际使用中发现 Logstash 启动的服务端口不能超过两个,不然会接收不到上传的信息
参考