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"

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

相关推荐
ruleslol5 小时前
SpringBoot面试题03-BeanFactory
spring boot
TTBIGDATA6 小时前
【Ambari开启Kerberos】KERBEROS SERVICE CHECK 报错
大数据·运维·hadoop·ambari·cdh·bigtop·ttbigdata
开利网络6 小时前
合规底线:健康产品营销的红线与避坑指南
大数据·前端·人工智能·云计算·1024程序员节
非著名架构师6 小时前
量化“天气风险”:金融与保险机构如何利用气候大数据实现精准定价与投资决策
大数据·人工智能·新能源风光提高精度·疾风气象大模型4.0
Hello.Reader7 小时前
用 CdcUp CLI 一键搭好 Flink CDC 演练环境
大数据·flink
刘一说7 小时前
深入理解 Spring Boot 中的数据库迁移:Flyway 与 Liquibase 实战指南
数据库·spring boot·oracle
努力的小郑7 小时前
Elasticsearch 避坑指南:我在项目中总结的 14 条实用经验
后端·elasticsearch·性能优化
熙梦数字化7 小时前
2025汽车零部件行业数字化转型落地方案
大数据·人工智能·汽车
Hello.Reader7 小时前
Flink CDC「Data Pipeline」定义与参数速查
大数据·flink
一叶飘零_sweeeet7 小时前
SpringBoot 集成 RabbitMQ
spring boot·rabbitmq·java-rabbitmq