首页 > 解决方案 > 带有条件的 filebeat add_fields 处理器

问题描述

我想在 Filebeat“apache”模块导出到 Graylog 的每一行中添加一个值为“apache-access”的字段“app”。

当我在 Graylog 中看到“event_dataset”="apache.access" 字段时,以下配置应添加该字段,但不执行任何操作。如果我删除条件,“add_fields”处理器确实会添加一个字段。

filebeat.inputs:
- type: log
  enabled: false
  paths:
    - /var/log/*.log
filebeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false
setup.template.settings:
  index.number_of_shards: 1
setup.kibana:
output.logstash:
  hosts: [ "localhost:5044" ]

processors:
- add_fields:
    when:
      equals:
        event_dataset: "apache.access"
    target: ""
    fields:
      app: "apache-access"

logging.level: info

标签: filebeat

解决方案


无论出于何种原因,该字段在 filebeat 中称为“event.dataset”,但在 Graylog 中显示为“event_dataset”。


推荐阅读