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

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

相关推荐
大大大大晴天1 天前
Hudi Metadata Table 与 Hive Sync (HMS)怎么选?
大数据
手可摘星辰7771 天前
一次线上FlinkCDC异常排查复盘
大数据·flink
大大大大晴天1 天前
Hudi技术内幕:Metadata Table原理与实践
大数据
武子康2 天前
调查研究-197 FAISS vs Elasticsearch 全面对比:从向量检索、全文搜索到 RAG 选型指南
人工智能·elasticsearch·agent
大大大大晴天2 天前
Hudi技术内幕:深入解析Index索引机制
大数据
阿里云大数据AI技术3 天前
Flink Forward Asia 2026 深圳启幕:Agentic Streaming for AI,开启实时智能新范式
大数据·flink
SelectDB3 天前
阶跃星辰基于 SelectDB 构建 PB 级 Agent 可观测平台
大数据·数据库·aigc
Elasticsearch3 天前
Elasticsearch ES|QL:现已支持视图、子查询和读取时模式定义
elasticsearch
Elasticsearch6 天前
Kibana 中的 SNMP 拓扑数据:从采集到 Canvas
elasticsearch
大大大大晴天6 天前
Hudi技术内幕:RecordPayload到RecordMerger
大数据