默认的filebeat配置会把所有的索引都放到一个文件中,通过摸索发现可以自定义索引的名字、模板、生命周期
(重点注意)该配置文件只适应于ES版本是7,不适应于8的版本,两个版本的配置文件差异很大
- /app/logs/info.log日志文件为JSON格式
- 自定义索引生命周期名为:pn_springboot,可提前建好
- 自定义索引名为:idx_springboot
- 自写义索引模板名为:tn_springboot
这样上传到es的索引名为idx_springboot-20240721-000001的索引名,不是默认的filebeat了
filebeat.inputs:
- type: log
paths:
- /app/logs/info.log
json.keys_under_root: true
json.add_error_key