filebeat收集java日志
filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths: /usr/local/java/logs/*.log
fields:
public_ip: x.x.x.x
private_ip: x.x.x.x
env: prod
server_type: xxx
fields_under_root: true
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}' # 正则匹配开头,微服务全部是时间开头
multiline.negate: true # 不是时间开头的,合并一行
multiline.match: after
# 输出到 Logstash, 数据处理
output.logstash:
hosts: ["192.168.0.134:4560"]
# 如果不需要数据处理,直接收集
#output.elasticsearch:
# hosts: ["192.168.0.134:9200"]
# username: "elastic"
# password: "elastic"多日志文件,根据文件名生产不同的索引
Last updated