Elasticsearch:字段[hostname]上没有声明类型[keyword]的处理程序

问题描述 投票:13回答:1

从filebeat索引日志时,我在Elasticsearch上面得到了Mapper解析错误。

我尝试了Filebeat - > Elasticserach和Filebeat - > Logstash - > Elasticsearch方法。

我按照自己的文档,按照Loading the Index Template in Elasticsearch | Filebeat Reference的指示安装了filebeat模板

我的弹性搜索通常与我的其他数据索引工作正常,我在Kibana上测试它们。它是官方码头Docker Hub | Elasticsearch安装。

谷歌搜索了很多运气,所以,任何帮助表示赞赏。

更新1:

ES版本:2.3.3(我相信最新版本)

模板文件是filebeat附带的默认文件。

{
  "mappings": {
    "_default_": {
      "_all": {
        "norms": false
      },
      "dynamic_templates": [
        {
          "fields": {
            "mapping": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "match_mapping_type": "string",
            "path_match": "fields.*"
          }
        }
      ],
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "beat": {
          "properties": {
            "hostname": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "name": {
              "ignore_above": 1024,
              "type": "keyword"
            }
          }
        },
        "input_type": {
          "ignore_above": 1024,
          "type": "keyword"
        },
        "message": {
          "norms": false,
          "type": "text"
        },
        "offset": {
          "type": "long"
        },
        "source": {
          "ignore_above": 1024,
          "type": "keyword"
        },
        "type": {
          "ignore_above": 1024,
          "type": "keyword"
        }
      }
    }
  },
  "order": 0,
  "settings": {
    "index.refresh_interval": "5s"
  },
  "template": "filebeat-*"
}

更新2:你是对的,看

#/usr/share/filebeat/bin/filebeat --version filebeat version 5.0.0-alpha2 (amd64), libbeat 5.0.0-alpha2

虽然这是将apache日志发布到logstash。但我无法以正确的格式获取此vhost_combined日志

sub1.example.com:443 1.9.202.41 - - [03/Jun/2016:06:58:17 +0000] "GET /notifications/pendingCount HTTP/1.1" 200 591 0 32165 "https://sub1.example.com/path/index?var=871190" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"

"message" => "%{HOSTNAME:vhost}\:%{NUMBER:port} %{COMBINEDAPACHELOG}"

elasticsearch logstash elastic-stack filebeat
1个回答
20
投票

您不能将"type": "keyword"与ES 2.3.3一起使用,因为这是ES 5中的新数据类型(目前在alpha3中)

您需要替换所有这些事件

"type": "string",
"index": "not_analyzed"

你需要使用filebeat.template-es2x.json代替。

© www.soinside.com 2019 - 2024. All rights reserved.