0
点赞
收藏
分享

微信扫一扫

ELK日志收集之filebeat input使用log和filestream采集日志

今天你读书了吗 2024-11-01 阅读 17

一、简介

Filebeat采集日志输入时,使用log和filestream模块采集日志,7.16版本开始弃用log模块。

二、配置示例

使用log模块采集日志

filebeat.inputs:
- type: log
  paths:
    - /var/log/messages
    - /var/log/*.log

使用log模块采集JSON格式日志

filebeat.inputs:
- type: log
  paths:
    - /path/to/json.log
  json.keys_under_root: true
  json.add_error_key: true
  json.message_key: log

使用filestream模块采集日志

filebeat.inputs:
- type: filestream
  id: my-filestream-id
  paths:
    - /var/log/messages
    - /var/log/*.log

使用filestream模块采集JSON格式日志

filebeat.inputs:
- type: filestream
  paths:
    - /path/to/your/json.log  # 指定日志文件路径
  json.keys_under_root: true  # 将所有JSON字段放在根级别
  json.overwrite_keys: true   # 如果有重复字段,则覆盖它们
 
processors:
  - decode_json_fields:
      fields: ["*"]  # 解析所有字段
      target: ""     # 不改变原始字段名



举报

相关推荐

0 条评论