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

打印 上一主题 下一主题

主题 971|帖子 971|积分 2913

默认的filebeat配置会把所有的索引都放到一个文件中,通过探索发现可以自界说索引的名字、模板、生命周期
(重点留意)该配置文件只适应于ES版本是8,不适应于其他版本


  • /app/logs/info.log日志文件为JSON格式
  • 自界说索引生命周期名为:pn_springboot,可提前建好
  • 自界说索引名为:idx_springboot
  • 自写义索引模板名为:tn_springboot
ES8版本默认生成的是数据流,不是默认的索引,这么配置生成的数据流名称就是idx_springboot,不是默认的filebeat了,如查索引发现生成长索引名是.ds-idx_springboot-2024.07.21-000001这种格式的,但我们配置视图时,选idx_springboot就行了
  1. filebeat.inputs:
  2.   - type: filestream
  3.     id: my-filestream-id
  4.     enabled: true
  5.     paths:
  6.       - /app/logs/info.log
  7.     parsers:
  8.       - ndjson:
  9.           keys_under_root: true
  10.           overwrite_keys: true
  11. setup.template.name: "tn_springboot"
  12. setup.template.pattern: "idx_springboot"
  13. setup.template.overwrite: true
  14. setup.template.settings:
  15.   index.lifecycle.name: "pn_springboot"
  16.   index.number_of_replicas: 0
  17. output.elasticsearch:
  18.   hosts: ["http://192.168.21.2:8800"]
  19.   username: "elastic"
  20.   password: "elastic"
  21.   index: "idx_springboot"
复制代码
为保护我的个人隐私,有的生命周期名、索引名、模板名我做过修改,如发现有问题,可批评,或与我联系

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

万有斥力

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表