Elasticsearch:没有在字段 [hostname] 上声明的类型 [keyword] 的处理程序
Elasticsearch: No handler for type [keyword] declared on field [hostname]
当从 filebeat 索引日志时,我在 Elasticsearch 上遇到以上 Mapper Parsing Error。
我尝试了 Filebeat -> Elasticserach 和 Filebeat -> Logstash -> Elasticsearch 这两种方法。
我遵循了他们自己的文档,我按照 Loading the Index Template in Elasticsearch | Filebeat Reference
的指示和验证安装了 filebeat 模板
我的 elasticsearch 通常与我的其他数据索引一起工作正常,我在 Kibana 上测试了它们。它是官方 docker Docker Hub | Elasticsearch 安装。
在 Google 上搜索了很多,但都没有成功,因此,我们将不胜感激。
更新 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}"
您不能将 "type": "keyword"
与 ES 2.3.3 一起使用,因为这是 ES 5 中的新数据类型(目前在 alpha3 中)
您需要用
替换所有这些出现的地方
"type": "string",
"index": "not_analyzed"
您需要改用 filebeat.template-es2x.json
。
当从 filebeat 索引日志时,我在 Elasticsearch 上遇到以上 Mapper Parsing Error。
我尝试了 Filebeat -> Elasticserach 和 Filebeat -> Logstash -> Elasticsearch 这两种方法。
我遵循了他们自己的文档,我按照 Loading the Index Template in Elasticsearch | Filebeat Reference
的指示和验证安装了 filebeat 模板我的 elasticsearch 通常与我的其他数据索引一起工作正常,我在 Kibana 上测试了它们。它是官方 docker Docker Hub | Elasticsearch 安装。
在 Google 上搜索了很多,但都没有成功,因此,我们将不胜感激。
更新 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}"
您不能将 "type": "keyword"
与 ES 2.3.3 一起使用,因为这是 ES 5 中的新数据类型(目前在 alpha3 中)
您需要用
替换所有这些出现的地方"type": "string",
"index": "not_analyzed"
您需要改用 filebeat.template-es2x.json
。