Elasticseachでのpipeline指定

filebeat→インジェストノードへのファイル転送を行おうとしているのですが、filebeatでpipelineを指定すると、インジェストノード側でエラーになってしまいます。
原因について、ご教示いただけないでしょうか

[2019-09-13T17:05:44,198][DEBUG][o.e.a.b.TransportBulkAction] [vm-phn5-sock201.fcxlocal] failed to execute pipeline [squid_accessES] for document [filebeat-7.3.1/_doc/null]
org.elasticsearch.ElasticsearchException: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Provided Grok expressions do not match field value: [1286536308.895 180 192.168.0.224 TCP_MISS/200 411 GET http://liveupdate.symantecliveupdate.com/minitri.flg - DIRECT/125.23.216.203 text/plain]
at org.elasticsearch.ingest.CompoundProcessor.newCompoundProcessorException(CompoundProcessor.java:194) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.ingest.CompoundProcessor.execute(CompoundProcessor.java:133) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.ingest.Pipeline.execute(Pipeline.java:100) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.ingest.IngestService.innerExecute(IngestService.java:427) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.ingest.IngestService.access$100(IngestService.java:70) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.ingest.IngestService$3.doRun(IngestService.java:355) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:758) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.3.1.jar:7.3.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:835) [?:?]
Caused by: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Provided Grok expressions do not match field value: [1286536308.895 180 192.168.0.224 TCP_MISS/200 411 GET http://liveupdate.symantecliveupdate.com/minitri.flg - DIRECT/125.23.216.203 text/plain]

■filebeat.yml設定内容
#================================ Outputs =====================================

Configure what output to use when sending the data collected by the beat.

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:

# Array of hosts to connect to.

hosts: ["XXX.XXX.XXX.XXX:9200"]

# Optional protocol and basic auth credentials.

#protocol: "https"

username: ""
password: "
"
pipeline: "squid_accessES"

■インジェストノードへのpipeline登録
PUT /_ingest/pipeline/squid_accessES
{
"processors" : [
{
"grok" : {
"field" : "message",
"patterns" : ["%{NUMBER:utctime} %{NUMBER:duration} %{IP:clientip} %{PROG:resultcode} %{NUMBER:bytes} %{WORD:requestmethod} %{GREEDYDATA:requesturl} %{PROG:rfc391} %{GREEDYDATA:hierarchycode} %{PROG:type}"]
}
},
{
"date_index_name" : {
"field" : "@timestamp",
"index_name_prefix" : "filebeat",
"date_rounding" : "d"
}
}
]
}

表示されているエラーは、Grokのプロセッサーで送られてきた文字列がパースできませんでした、とあるので、まずIngest Nodeの中を確認してみては、と思うのです。

いま、quid_accessESというpipelineが既に登録されているかと思うので、_simulateのAPIを実行してみてください。
"message"は、上でパースができないとエラーがでていたときの中身です。

POST _ingest/pipeline/squid_accessES/_simulate
{
  "docs": [
    {
      "_source": {
        "message": "1286536308.895 180 192.168.0.224 TCP_MISS/200 411 GET http://liveupdate.symantecliveupdate.com/minitri.flg - DIRECT/125.23.216.203 text/plain",
        "@timestamp": "2019-09-13T18:33:00.000Z"
      }
    }
  ]
}

このような結果になりますでしょうか?

もし、上の"message”の部分をGrokでエラーを起こすような文字列にして_simulateをすれば、
以下のような結果となり、提示いただいているエラーメッセージと合致します。

まずIngestのパイプライン自体でエラーが起きないかどうかを確認し、
Pipeline単体では起きないけれど、filebeatからPipelineを指定してデータを登録したときにエラーになるのかどうか、場合を切り分けるのが良いのではと思います。

ご回答ありがとうございます。ご指摘どおり、パースが失敗しておりました。grokの設定を見直して解決しました

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.