Logstash 管道不存在

Logstash pipeline doesn't exist

我从 开始遇到这个问题。

我创建了如下管道。

{
    "bool-pipeline": {
        "description": "converts FALSE/TRUE to boolean",
        "processors": [
            {
                "convert": {
                    "field": "secure_flag",
                    "type": "boolean",
                    "ignore_missing": true
                }
            }
        ]
    }
}

我的有效值为 FALSE、TRUE、[空白]

我能够检索管道。

我在 Logstash 配置中添加如下内容。

 input {
    file {
        path => "/Users/gibbs/Documents/search/mini_system.csv"
        start_position => beginning
        sincedb_path => "/dev/null"
    }
}
filter {
    csv {
        columns => [
               "secure_flag",
               "mini_system_key",
               "hw_contract_end_date"
        ]
        separator => ","
        }
  mutate {
    remove_field => ["path", "host"]
  }
}
output {
    stdout {
        codec => rubydebug
    }
    elasticsearch {
        action => "index"
        hosts => ["127.0.0.1:9200"]
        index => "mini_system"
        document_id => "%{mini_system_key}"
        pipeline => "%{bool-pipeline}"
    }
}

但是当我加载数据时,它会抛出以下错误。

    [2020-05-10T16:13:05,691][DEBUG][o.e.a.b.T.BulkRequestModifier] [gopir-mac-1] failed to execute pipeline [_none] for document [mini_system/_doc/50395971|1038832]
java.lang.IllegalArgumentException: pipeline with id [%{bool-pipeline}] does not exist
    at org.elasticsearch.ingest.IngestService.executePipelines(IngestService.java:407) [elasticsearch-7.6.2.jar:7.6.2]
    at org.elasticsearch.ingest.IngestService.access[=12=]0(IngestService.java:75) [elasticsearch-7.6.2.jar:7.6.2]
    at org.elasticsearch.ingest.IngestService.doRun(IngestService.java:384) [elasticsearch-7.6.2.jar:7.6.2]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:692) [elasticsearch-7.6.2.jar:7.6.2]
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.6.2.jar:7.6.2]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_231]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_231]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

我一无所知。我现在正在尝试几个小时。

有什么建议吗?

当我检查日志时,我在弹性搜索日志中看到了那个错误。 Logstash 有一个衬里。

您的摄取管道名称是 bool-pipeline,您应该在 elasticsearch 中使用它,而不是 %{bool-pipeline}

%{FIELD} 用于与事件相关的值,这不是您的情况,使用 %{bool-pipeline} 将使 logstash 尝试从名为bool-pipeline 在您的活动中,由于该字段不存在,您收到此错误。