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 小时前
Elasticsearch 9.x 本地RAG个人知识库实操
大数据·elasticsearch·搜索引擎
一只鹿鹿鹿18 小时前
智慧水利一体化建设方案
大数据·运维·开发语言·数据库·物联网
Elastic 中国社区官方博客20 小时前
使用 Elastic 进行网络监控:统一网络可观测性
大数据·开发语言·网络·人工智能·elasticsearch·搜索引擎·全文检索
海兰21 小时前
Elasticsearch 9.x 借助神经模型优化中文文本分析
大数据·elasticsearch·搜索引擎
海兰1 天前
ES9.x 银行场景:银行卡可疑交易风控工作流示例
java·elasticsearch·搜索引擎
500佰1 天前
Hive常见故障多案例FAQ宝典 --项目总结(宝典一)
大数据·linux·数据仓库·hive·hadoop·云计算·运维开发
老陈头聊SEO1 天前
深度解析长尾关键词与SEO优化提升效果的有效策略
其他·搜索引擎·seo优化
家的尚尚签1 天前
高定木作企业实践:案例分享与成果展示
大数据·人工智能·python