Filebeat 不会排除行

Filebeat won't exclude line

我有一个 Python 进程写入以下示例 JSON 日志行:

{"levelname": "DEBUG", "asctime": "2020-02-04 08:37:42,128", "module": "scale_out", "thread": 139793342834496, "filename": "scale_out.py", "lineno": 130, "funcName": "_check_if_can_remove_inactive_components", "message": "inactive_components: set([]), num_of_components_active: 0, max num_of_components_to_keep: 1"}

在 filebeat.yml 中,我试图排除所有 DEBUG 日志被发送到 Elasticsearch。
我试过使用 exclude_lines 关键字,但 Filebeat 仍然发布这些事件。

我也试过使用 processordrop event

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/my_service/*.log

  json.keys_under_root: true
  json.add_error_key: true
  json.message_key: "module"
  exclude_lines: ['DEBUG'] # also tried ['.*DEBUG.*']
  keep_null: true

processors:
 - drop_event:
     when:
        levelname: 'DEBUG'


知道我做错了什么吗?

嗯.. 它比我预期的要容易得多(也很愚蠢)。 虽然 exclude_lines 不起作用(仍然), 我能够让 drop_event 工作。

问题是 'DEBUG' 应该没有引号。

processors:
- drop_event:
    when:
      levelname: DEBUG