【发布时间】:2022-01-20 00:17:18
【问题描述】:
如何使用带有 Filebeat 模块的自定义摄取管道?就我而言,我使用的是apache 模块。
根据多个来源,这应该可以通过output.elasticsearch.pipeline / output.elasticsearch.pipelines[pipeline] 进行配置。来源如下:
- https://www.elastic.co/guide/en/beats/filebeat/current/elasticsearch-output.html#pipelines-option-es
- https://stackoverflow.com/a/58726519/1026263
- https://www.elastic.co/guide/en/beats/filebeat/current/elasticsearch-output.html#pipelines-option-es
但是,在多次尝试不同排列之后,我始终无法影响 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 图像中)都尝试过这个。
这与这些线程类似,从未有过令人满意的结论:
【问题讨论】: