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

默认的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就行了

yaml 复制代码
filebeat.inputs:
  - type: filestream
    id: my-filestream-id
    enabled: true
    paths:
      - /app/logs/info.log
    parsers:
      - ndjson:
          keys_under_root: true
          overwrite_keys: true

setup.template.name: "tn_springboot"
setup.template.pattern: "idx_springboot"
setup.template.overwrite: true
setup.template.settings:
  index.lifecycle.name: "pn_springboot"
  index.number_of_replicas: 0

output.elasticsearch:
  hosts: ["http://192.168.21.2:8800"]
  username: "elastic"
  password: "elastic"
  index: "idx_springboot"

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

相关推荐
Coder个人博客17 小时前
Linux6.19-ARM64 mm mmu子模块深入分析
大数据·linux·车载系统·系统架构·系统安全·鸿蒙系统
风流倜傥唐伯虎20 小时前
Spring Boot Jar包生产级启停脚本
java·运维·spring boot
fuquxiaoguang20 小时前
深入浅出:使用MDC构建SpringBoot全链路请求追踪系统
java·spring boot·后端·调用链分析
毕设源码_廖学姐21 小时前
计算机毕业设计springboot招聘系统网站 基于SpringBoot的在线人才对接平台 SpringBoot驱动的智能求职与招聘服务网
spring boot·后端·课程设计
顾北1221 小时前
MCP服务端开发:图片搜索助力旅游计划
java·spring boot·dubbo
财经三剑客21 小时前
AI元年,春节出行安全有了更好的答案
大数据·人工智能·安全
岁岁种桃花儿1 天前
Flink CDC从入门到上天系列第一篇:Flink CDC简易应用
大数据·架构·flink
昀贝1 天前
IDEA启动SpringBoot项目时报错:命令行过长
java·spring boot·intellij-idea
TOPGUS1 天前
谷歌SEO第三季度点击率趋势:榜首统治力的衰退与流量的去中心化趋势
大数据·人工智能·搜索引擎·去中心化·区块链·seo·数字营销
indexsunny1 天前
互联网大厂Java面试实战:Spring Boot微服务在电商场景中的应用与挑战
java·spring boot·redis·微服务·kafka·spring security·电商