【发布时间】:2017-03-21 15:57:00
【问题描述】:
所以我有一个弹性搜索模板,我通过 Filebeat 将其传递给 ES。我也有 Filebeat 发送到 logstash ......这是相关的东西。
Elasticsearch 模板
{
"template": "filebeat-*",
"mappings": {
"product__name": {
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "text"
},
"beat": {
"properties": {
"hostname": {
"type": "text"
},
"name": {
"type": "text"
}
}
},
"class_method": {
"type": "text"
},
"class_name": {
"type": "text",
"index": "true",
"fielddata": "true"
},
"clientip": {
"type": "ip"
},
"count": {
"type": "long"
},
"host": {
"type": "text"
},
"input_type": {
"type": "text"
},
"log_level": {
"type": "text",
"fielddata": "true",
"index": "true"
},
"log_message": {
"type": "text",
"index": "true"
},
"log_timestamp": {
"type": "text"
},
"log_ts": {
"type": "long"
},
"message": {
"type": "text"
},
"offset": {
"type": "long"
},
"query_params": {
"type": "text",
"fielddata": "true",
"index": "true"
},
"sessionid": {
"type": "text",
"index": "true"
},
"source": {
"type": "text"
},
"tags": {
"type": "text"
},
"thread": {
"type": "text",
"index": "true"
},
"type": {
"type": "text"
},
"user_account_combo": {
"type": "text",
"index": "true"
},
"version": {
"type": "text"
}
}
},
"access": {
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "text"
},
"beat": {
"properties": {
"hostname": {
"type": "text"
},
"name": {
"type": "text"
}
}
},
"clientip": {
"type": "ip"
},
"count": {
"type": "long"
},
"host": {
"type": "text",
"index": "true"
},
"input_type": {
"type": "text"
},
"log_timestamp": {
"type": "text"
},
"log_ts": {
"type": "long"
},
"message": {
"type": "text"
},
"offset": {
"type": "long"
},
"query_params": {
"type": "text",
"fielddata": "true",
"index": "true"
},
"response_time": {
"type": "long"
},
"sessionid": {
"type": "text",
"index": "true"
},
"source": {
"type": "text"
},
"statuscode": {
"type": "long"
},
"tags": {
"type": "text"
},
"thread": {
"type": "text",
"index": "true"
},
"type": {
"type": "text",
"index": "true"
},
"uripath": {
"type": "text",
"fielddata": "true",
"index": "true"
},
"user_account_combo": {
"type": "text",
"index": "true"
},
"verb": {
"type": "text",
"fielddata": "true",
"index": "true"
}
}
}
}
}
filebeat 配置(已修整)
output.elasticsearch:
hosts: ["10.10.43.210:9200"]
template:
name: filebeat
path: "test-template.json"
overwrite: true
output.logstash:
hosts: ["10.10.43.210:5044"]
worker: 2
index: filebeat
Logstash 配置(已修整)
output {
stdout { }
elasticsearch {
hosts => "elasticsearch:9200"
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
最后...这是 Kibana 中显示的内容:
所以问题是:当我非常明确地知道我希望所有内容是什么类型并且不让 logstash 覆盖我的模板时,为什么我会在事物上看到 .keyword 字段?我错过了什么吗?
【问题讨论】:
标签: templates elasticsearch logstash kibana filebeat