可以使用 Filebeat 的 include_linesexclude_lines 选项来实现过滤日志,去除包含 'test' 字符的行。

方法一:只采集不包含 'test' 字符的行

设置 include_lines 选项,指定只采集含有非 'test' 字符的行:

filebeat.inputs:
- type: log
  paths:
    - /path/to/your/logfile
  exclude_lines: ['test']

方法二:采集所有行,但去除包含 'test' 字符的行

设置 exclude_lines 选项,指定采集所有行,但去除含有 'test' 字符的行:

filebeat.inputs:
- type: log
  paths:
    - /path/to/your/logfile
  include_lines: ['.*']
  exclude_lines: ['test']

以上两种方法都可以达到去除含有 'test' 字符的行的效果,具体选择哪种方法取决于你的需求和日志格式。

Filebeat 日志采集:如何去除包含 'test' 字符的行

原文地址: https://www.cveoy.top/t/topic/nozi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录