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

ray*_*han 13 elasticsearch logstash elastic-stack filebeat

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

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

我按照他们自己的文档,按照指示安装了filebeat模板,并通过在Elasticsearch中加载索引模板进行验证.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-*"
}
Run Code Online (Sandbox Code Playgroud)

更新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}"

Val*_*Val 20

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

您需要替换所有这些事件

"type": "string",
"index": "not_analyzed"
Run Code Online (Sandbox Code Playgroud)

你需要filebeat.template-es2x.json改用.