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

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

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

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

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

yaml 复制代码
filebeat.inputs:
- type: log
  paths:
    - /app/logs/info.log
  json.keys_under_root: true
  json.add_error_key: true
  json.overwrite_keys: true

setup.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版本)

为保护我的个人隐私,有的生命周期名、索引名、模板名我做过修改,如发现有问题,可评论,或与我联系

相关推荐
商业讯网12 小时前
国家电投海外项目运营经验丰富
大数据·人工智能·区块链
面向Google编程2 小时前
Flink源码阅读:Mailbox线程模型
大数据·flink
铭毅天下3 小时前
基于 Easysearch + Flip 的多模态图像搜索引擎系统实战指南
搜索引擎
Elastic 中国社区官方博客3 小时前
使用 Elastic 中的 OpenTelemetry 为 Nginx 实现端到端分布式追踪的实用指南
大数据·运维·分布式·elasticsearch·搜索引擎·信息可视化·全文检索
aliprice4 小时前
逆向拆解:用速卖通图片搜索破解竞品设计,找到你的差异化定价空间
大数据·跨境电商·电商
hg01184 小时前
埃及:在变局中重塑发展韧性
大数据·人工智能·物联网
向量引擎小橙5 小时前
“2026数据枯竭”警报拉响:合成数据如何成为驱动AI进化的“新石油”?
大数据·人工智能·深度学习·集成学习
飞Link5 小时前
【大数据】SparkSQL常用操作
大数据·数据挖掘·spark
阿里云大数据AI技术5 小时前
Agentic Search: AI驱动的下一代企业搜索
搜索引擎
m0_466525295 小时前
东软添翼AI 2.0获评医疗健康标杆AI Agent TOP10
大数据·人工智能