【问题标题】:How to Use a Custom Ingest Pipeline with a Filebeat Module如何使用带有 Filebeat 模块的自定义摄取管道
【发布时间】:2022-01-20 00:17:18
【问题描述】:

如何使用带有 Filebeat 模块的自定义摄取管道?就我而言,我使用的是apache 模块。

根据多个来源,这应该可以通过output.elasticsearch.pipeline / output.elasticsearch.pipelines[pipeline] 进行配置。来源如下:

但是,在多次尝试不同排列之后,我始终无法影响 Filebeat 使用哪个摄取管道;它总是使用模块的股票摄取管道。

这只是众多尝试之一:

filebeat.config:

filebeat.modules:
  - module: apache
    access:
      enabled: true
      var.paths: ["/var/log/apache2/custom_access*"]
    error:
      enabled: true
      var.paths: ["/var/log/apache2/custom_error*"]

filebeat.config.modules:
  reload.enabled: true
  reload.period: 5s

output.elasticsearch:
  hosts: ["${ELASTICSEARCH_URL}"]
  pipeline: "apache_with_optional_x_forwarded_for"

使用调试运行 filebeat (-d "*") 显示以下内容,我假设这表明我的规范已被忽略。 (我还可以通过 Elasticsearch 中的生成文档告诉我,我的自定义管道被回避了。)

2021-12-16T23:23:47.464Z      DEBUG   [processors]    processing/processors.go:203    Publish event: {
  "@timestamp": "2021-12-16T23:23:47.464Z",
  "@metadata": {
    "beat": "filebeat",
    "type": "_doc",
    "version": "7.10.2",
    "pipeline": "filebeat-7.10.2-apache-access-pipeline"
  },

我在 Filebeat v6.8 和 v7.10(在 docker.elastic.co/beats/filebeat docker 图像中)都尝试过这个。


这与这些线程类似,从未有过令人满意的结论:

【问题讨论】:

    标签: elasticsearch filebeat


    【解决方案1】:

    好吧,根据beats存储库上的这个PR,要覆盖模块管道,您需要在input配置中指定自定义管道,而不是在output上。

    试试这个:

    filebeat.modules:
      - module: apache
        access:
          enabled: true
          input.pipeline: your-custom-pipeline
          var.paths: ["/var/log/apache2/custom_access*"]
        error:
          enabled: true
          input.pipeline: your-custom-pipeline
          var.paths: ["/var/log/apache2/custom_error*"]
    

    【讨论】:

    • 您的回答让我找到了the right spot in the docs 模块input.pipeline 但是,文档还提到这在output 中也是可行的,这可能是一个损坏的功能。下周我将在模块配置中尝试它,看看它是否真的像记录的那样起作用。感谢您的回复,@leandrojmp。
    猜你喜欢
    • 2022-01-13
    • 2021-11-08
    • 1970-01-01
    • 2022-08-23
    • 1970-01-01
    • 1970-01-01
    • 2014-02-24
    • 1970-01-01
    • 2015-09-11
    相关资源
    最近更新 更多