gpt4 book ai didi

elasticsearch - ElasticSearch 6.2.4 的 filebeat-index-template.json

转载 作者:行者123 更新时间:2023-11-29 02:56:44 25 4
gpt4 key购买 nike

我正在运行 ElasticSearch 6.2.4。我尝试创建 Filebeat 索引模板,但出现以下错误

{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "No handler for type [string] declared on field [message]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_default_]: No handler for type [string] declared on field [message]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "No handler for type [string] declared on field [message]"
}
},
"status" : 400
}

filebeat-index.template.json

{
"mappings": {
"_default_": {
"_all": {
"enabled": true,
"norms": {
"enabled": false
}
},
"dynamic_templates": [
{
"template1": {
"mapping": {
"doc_values": true,
"ignore_above": 1024,
"index": "not_analyzed",
"type": "{dynamic_type}"
},
"match": "*"
}
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"message": {
"type": "string",
"index": "analyzed"
},
"offset": {
"type": "long",
"doc_values": "true"
},
"geoip" : {
"type" : "object",
"dynamic": true,
"properties" : {
"location" : { "type" : "geo_point" }
}
}
}
}
},
"settings": {
"index.refresh_interval": "5s"
},
"template": "filebeat-*"
}

我想知道是否有适用于 ElasticSearch 6.2.4 的官方 filebeat-index-template.json

我尝试过的其他事情

  • 尝试 filebeat -c "/etc/filebeat/filebeat.yml"export template > filebeat.template.json,但 filebeat 将永远运行而不会创建任何内容。
  • 我尝试将 "type": "string" 更改为 "type": "text",,但在 _all 已弃用。
  • 我也曾尝试删除 _all,但当 Logstash 将数据发送到 ElasticSearch 时,ElasticSearch 一直出现解析错误。

Filebeat 版本 [旧]

我还尝试找出我的 Filebeat 的版本。我试过了

> filebeat -v
Loading config file error: Failed to read /root/filebeat.yml: open /root/filebeat.yml: no such file or directory. Exiting.

> filebeat -v -c "/etc/filebeat/filebeat.yml"
(it struck forever)

我正在关注这个https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elk-stack-on-ubuntu-14-04 ,但我没有使用 ElasticSearch 2.0 和 Kibana 4.5,而是安装了 ElasticSearch 6.2.4、Kibana 6.2.4、Logstash 6.2.4 和 Ubuntu 16.04.4 LTS

升级到 Filebeat 6.2.4

现在我正在将 Filebeat 升级到 6.2.4。现在我得到这个错误

Exiting: Could not start registrar: Error loading state: Error decoding states: json: cannot unmarshal object into Go value of type []file.State

我通过 rm/var/lib/filebeat/registry 删除了这个错误。现在我可以执行 filebeat export template > template.json 并且现在工作正常。我会尽快关闭问题。

最佳答案

filebeat-index.template.json

尝试使用这个 elastic 6.0 修改的 json
{
"mappings": {
"_default_": {
"dynamic_templates": [
{
"template1": {
"mapping": {
"doc_values": true,
"ignore_above": 1024,
"index": "false",
"type": "{dynamic_type}"
},
"match": "*"
}
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"message": {
"type": "text",
"index": "true"
},
"offset": {
"type": "long",
"doc_values": "true"
},
"geoip": {
"type": "object",
"dynamic": true,
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
},
"settings": {
"index.refresh_interval": "5s"
},
"template": "filebeat-*"
}

基本上,我将消息类型从 string 更改为 text。同样从 elastic 6.0 开始,索引字段使用 truefalse,而不是 analyzed

运行此命令后(如您在上面提到的 blog 中所建议):

curl -XPUT 'http://localhost:9200/_template/filebeat?pretty' -d@filebeat-index-template.json -H 'Content-Type: application/json'

我设法从 elastic 得到了正确的确认:

{ 
"acknowledged" : true
}

我还没有测试过,但如果它适合你,请告诉我。

您可能会注意到 _all 模板也从原始 json 中删除。为什么?显然是 depreciated in elastic 6.0并且有一些方法可以按照 here 中的建议使用 copy_to但我还没有弄明白。

关于elasticsearch - ElasticSearch 6.2.4 的 filebeat-index-template.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50093667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com