欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 创投人物 > filebeat把日志文件上传到Es中配置(ES7版本)

filebeat把日志文件上传到Es中配置(ES7版本)

2025/2/23 6:21:32 来源:https://blog.csdn.net/zhaojiyuan1024/article/details/140592760  浏览:    关键词:filebeat把日志文件上传到Es中配置(ES7版本)

默认的filebeat配置会把所有的索引都放到一个文件中,通过摸索发现可以自定义索引的名字、模板、生命周期

(重点注意)该配置文件只适应于ES版本是7,不适应于8的版本,两个版本的配置文件差异很大

  • /app/logs/info.log日志文件为JSON格式
  • 自定义索引生命周期名为:pn_springboot,可提前建好
  • 自定义索引名为:idx_springboot
  • 自写义索引模板名为:tn_springboot

这样上传到es的索引名为idx_springboot-20240721-000001的索引名,不是默认的filebeat了

filebeat.inputs:
- type: logpaths:- /app/logs/info.logjson.keys_under_root: truejson.add_error_key: truejson.overwrite_keys: truesetup.ilm.enabled: auto
setup.ilm.rollover_alias: "idx_springboot"
setup.ilm.pattern: "{now/d}-000001"
setup.ilm.policy_name: "pn_springboot"setup.template.enabled: true
setup.template.name: "tn_springboot"
setup.template.pattern: "idx_springboot-*"
setup.template.overwrite: true
setup.template.settings:index.lifecycle.name: "pn_springboot"index.lifecycle.rollover_alias: "idx_springboot"output.elasticsearch:hosts: ["http://192.168.21.2:8800"]username: "elastic"password: "elastic"

我是感觉这么配置有点不太合理,es版本是8的配置就比较合理了,ES8版本配置:filebeat把日志文件上传到Es中配置(ES8版本)
为保护我的个人隐私,有的生命周期名、索引名、模板名我做过修改,如发现有问题,可评论,或与我联系

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词