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

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

相关推荐
IDIOT___IDIOT16 分钟前
关于 git 进行版本管理的时候 gitignore 写入忽略规则而不生效的问题
大数据·git·elasticsearch
不想看见40417 分钟前
Git 误删急救手册
大数据·git·elasticsearch
网络工程小王32 分钟前
【大数据技术详解】——Elasticsearch技术(学习笔记)
大数据·大数据技术·向量查询
TOWE technology39 分钟前
从“制造”到“智造”:智能PDU如何成为智慧工厂的电力“神经中枢”
大数据·人工智能·制造·数据中心·电源管理·智能pdu
2401_891655811 小时前
Git误操作急救手册大纲
大数据·elasticsearch·搜索引擎
LaughingZhu1 小时前
Product Hunt 每日热榜 | 2026-03-22
大数据·数据库·人工智能·经验分享·搜索引擎
进击的雷神1 小时前
Trae AI IDE 完全指南:从入门到精通
大数据·ide·人工智能·trae
七夜zippoe1 小时前
OpenClaw 会话管理:单聊、群聊、多模型
大数据·人工智能·fastapi·token·openclaw
longxibo2 小时前
【Ubuntu datasophon1.2.1 二开之八:验证实时数据入湖】
大数据·linux·clickhouse·ubuntu·linq
一只努力的微服务2 小时前
【Calcite 系列】深入理解 Calcite 的 AggregateFilterTransposeRule
大数据·数据库·calcite·优化规则