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

标签 elasticsearch logstash elastic-stack filebeat

当从 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 版本 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}"

最佳答案

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

您需要用

替换所有这些出现的地方
"type": "string",
"index": "not_analyzed"

您需要使用 filebeat.template-es2x.json相反。

关于Elasticsearch:没有在字段 [hostname] 上声明的类型 [keyword] 的处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37599410/

相关文章:

python - 使用策展人python API无法过滤和删除Elasticsearch的旧索引

search - 如何将多个字段添加到 ElasticSearch 中的常用术语查询?

elasticsearch - 将csv内容附加到现有的logstash索引

elasticsearch - elasticsearch 中的新索引中的映射是如何确定的

elasticsearch - 如果它们包含特定字段,如何限制Filebeat仅将日志发送到ELK?

elasticsearch - Elasticsearch Index Lifecycle Policy无法滚动的问题

elasticsearch - 如何从连续的RDD构造DStream?

logstash - 有什么办法可以在conf文件中放置相对路径吗?

elasticsearch - Logstash文件输入未写入AWS EC2上的Elasticsearch安装

java - 在 Logstash 7.0 中定义常量